Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Priority queue #6577

Merged
merged 26 commits into from
Jan 15, 2019
Merged

Priority queue #6577

merged 26 commits into from
Jan 15, 2019

Conversation

heifner
Copy link
Contributor

@heifner heifner commented Jan 9, 2019

Change Description

  • Add priority queue for main application thread
  • Use low priority for transaction processing
  • Use high priority for block production and block propagation

All posted jobs now require a priority that determines the order of execution. If any jobs are posted to the main application thread without using the provided priority wrapper they are executed as if they have the highest priority. Therefore, the priority wrapper should be used for all jobs posted either via post, async_read, async_write, async_wait, etc.

Consensus Changes

None

API Changes

Any plugins posting to the main application thread should consider using the new priority wrapper.

Documentation Additions

See API changes.

plugins/bnet_plugin/bnet_plugin.cpp Outdated Show resolved Hide resolved
plugins/net_plugin/net_plugin.cpp Outdated Show resolved Hide resolved
plugins/net_plugin/net_plugin.cpp Show resolved Hide resolved
plugins/producer_plugin/producer_plugin.cpp Outdated Show resolved Hide resolved
}

void net_plugin_impl::start_txn_timer() {
transaction_check->expires_from_now( txn_exp_period);
transaction_check->async_wait( [this](boost::system::error_code ec) {
transaction_check->async_wait(app().get_priority_queue().wrap(priority::low-1, [this](boost::system::error_code ec) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the mixed metaphor of priority is a category and priority is a number. I'm fine with having named points on the range, but then perhaps we can name this one as well (even if only locally).

I guess, in a single logical bit of code it should consistently treat priority as a category or a number but not both?

I have some comments on the appbase changes too that regard this duality

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used a variable to name it locally. appbase was updated to just always execute the highest so there are no more ranges only named points on the range.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants