Skip to content

Commit

Permalink
Fix default thread setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
manyoso committed Jul 11, 2023
1 parent 6630bf2 commit 18dbfdd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gpt4all-chat/mysettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ int MySettings::threadCount() const
QSettings setting;
setting.sync();
int c = setting.value("threadCount", default_threadCount).toInt();
// The old thread setting likely left many people with 0 in settings config file, which means
// we should reset it to the default going forward
if (c <= 0)
c = default_threadCount;
c = std::max(c, 1);
c = std::min(c, QThread::idealThreadCount());
return c;
Expand Down

0 comments on commit 18dbfdd

Please sign in to comment.