-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bsip36: clear expired feeds on maintenance interval #889
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you for documenting your test thoroughly. I was able to follow along easily.
libraries/chain/db_maint.cpp
Outdated
std::advance( itr, 1 ); | ||
if( feed_time < calculated ) | ||
o.feeds.erase( itr.base() ); // delete expired feed | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you, but you could replace this with something like:
o.feeds.erase(
std::remove_if(o.feeds.begin(), o.feeds.end(),
[calculated] (auto f) { return f.second.first < calculated; }),
o.feeds.end());
(Untested, just typing out loud)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry. remove_if doesn't work for map (until perhaps C++20). Please ignore.
libraries/chain/db_maint.cpp
Outdated
|
||
for( const auto& d : get_index_type<asset_bitasset_data_index>().indices() ) | ||
{ | ||
modify( d, [this,head_time,head_epoch_seconds,after_hf_core_518]( asset_bitasset_data_object &o ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing in the capture list changes within the for-loop, it would be more efficient to pull the lambda creation out of the loop.
@@ -176,6 +176,9 @@ namespace graphene { namespace chain { | |||
static const uint8_t space_id = implementation_ids; | |||
static const uint8_t type_id = impl_asset_bitasset_data_type; | |||
|
|||
/// The asset this object belong to | |||
asset_id_type asset_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must bump GRAPHENE_CURRENT_DB_VERSION when modifying DB object structures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
New PR for issue: #518, refactored from PR #832.
BSIP: https://github.com/bitshares/bsips/blob/master/bsip-0036.md