Page MenuHomePhabricator

Migrate seeder to use node's sleep utility function
ClosedPublic

Authored by thonkle on Mar 1 2022, 18:55.

Details

Reviewers
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABC29d401ca0636: Migrate seeder to use node's sleep utility function
Summary

UninterruptibleSleep already provides a way to use std::chrono::duration.
This patch improves code readability and make changes in D10666 less error prone by
removing seeder's Sleep in favor of UninterruptibleSleep that the node uses.

Test Plan
ninja check-seeder bitcoin-seeder
./src/seeder/bitcoin-seeder

Examine output in dnsseed.dump. Use ls -al to verify dump is occurring at expected intervals.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Mar 1 2022, 18:55
thonkle requested review of this revision.Mar 1 2022, 18:55
Fabien requested changes to this revision.Mar 2 2022, 10:30
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/seeder/main.cpp
322 ↗(On Diff #32563)

You can use the literal form: UninterruptibleSleep(1s);

339 ↗(On Diff #32563)

UninterruptibleSleep(30min);

430 ↗(On Diff #32563)

UninterruptibleSleep(20ms);

This revision now requires changes to proceed.Mar 2 2022, 10:30

Use duration literals where possible.

This revision is now accepted and ready to land.Mar 3 2022, 08:11