Skip to content
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

Clear peers and online weight after 1 week of inactivity #2506

Merged

Conversation

guilhermelawless
Copy link
Contributor

To test, add this after L775 in node.cpp

store.online_weight_put (transaction, (std::chrono::system_clock::now () - std::chrono::hours (8 * 24)).time_since_epoch ().count (), nano::amount (1000));

Do we have any other way of reaching the last entry without using two iterators as I did?

@guilhermelawless guilhermelawless added this to the V21.0 milestone Jan 22, 2020
@guilhermelawless guilhermelawless self-assigned this Jan 22, 2020
@guilhermelawless guilhermelawless added the database Relates to lmdb or rocksdb label Jan 24, 2020
Copy link
Contributor

@wezrule wezrule left a comment

Choose a reason for hiding this comment

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

Do we have any other way of reaching the last entry without using two iterators as I did?

There is a way to use a reverse iterator in LMDB (maybe rocksdb as well I haven't checked), but we don't have any infrastructure wrapping it currently. I think this way is fine because online_weight only has 4032 keys and this is only called once on start-up.

@guilhermelawless guilhermelawless merged commit 2d503c3 into nanocurrency:develop Jan 24, 2020
@guilhermelawless guilhermelawless deleted the long-inactivity-cleanup branch January 24, 2020 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Relates to lmdb or rocksdb enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants