iron-fish / ironfish

A novel cryptocurrency focused on privacy and accessibility.
https://ironfish.network
Mozilla Public License 2.0
964 stars 577 forks source link

Automatically start the worker pool if a job is submitted #5039

Closed andiflabs closed 3 weeks ago

andiflabs commented 4 weeks ago

Summary

The worker pool is a thread pool that allows multiple jobs to run concurrently. The worker pool is normally started only when a full node is initialized. If a full node is not initialized, then no separate thread is started, and jobs are not run concurrently but sequentially.

This means that the performance of CLI commands that use the worker pool, like wallet:rescan, can vary drastically depending on whether a full node is running or not. This behavior is not documented and far from obvious from a user prospective.

To always offer the best performance, this commit changes the worker pool to ensure that threads are always spawned before executing any job.

Testing Plan

with a node NOT running:

Alternatively: observe the time that wallet:rescan takes when running with/without a node.

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API Reference)? If yes, link a related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and label it with breaking-change-rpc or breaking-change-sdk.

[ ] Yes