nano-node
nano-node copied to clipboard
This change creates an scheduler::limiter class which tracks and limits how many elections can be spawned.
The class is a facade around the active_transactions class and exposes a query scheduler::limiter::available to see if there is capacity available and a method scheduler::limiter::insert which checks for availability before inserting an election. Elections are inserted and tracked by the scheduler::limiter class. Coherency is maintained in a lazy manor by holding weak_ptrs to nano::elections and removing them if the pointer has expired or the election is no longer active as reported by active_transactions.
Previous discussion was on this branch https://github.com/nanocurrency/nano-node/pull/4133