Skip to content

Commit

Permalink
Limit parallel script processing thread pool to 4 by default (#1764)
Browse files Browse the repository at this point in the history
* Defaults: Limit script threads to 2 by default

* Defaults: Limit script threads to 4 by default

* Tweak logic to align better with negative values

* Fix tweak

* Revert "Tweak logic to align better with negative values"

This reverts commit 33df70d.
  • Loading branch information
prasannavl authored Feb 21, 2023
1 parent e904fcd commit fac10f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,10 @@ bool AppInitMain(InitInterfaces& interfaces)
// -par=0 means autodetect (number of cores - 1 script threads)
// -par=-n means "leave n cores free" (number of cores - n - 1 script threads)
script_threads += GetNumCores();
// DeFiChain specific:
// Set this to a max value, since most custom TXs don't utilize this unfortunately
// and is just a waste of resources.
script_threads = std::min(script_threads, 4);
}

// Subtract 1 because the main thread counts towards the par threads
Expand Down

0 comments on commit fac10f3

Please sign in to comment.