MCPcopy Create free account
hub / github.com/ElementsProject/elements / StartScheduledTasks

Method StartScheduledTasks

src/net_processing.cpp:1497–1509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1495}
1496
1497void PeerManagerImpl::StartScheduledTasks(CScheduler& scheduler)
1498{
1499 // Stale tip checking and peer eviction are on two different timers, but we
1500 // don't want them to get out of sync due to drift in the scheduler, so we
1501 // combine them in one function and schedule at the quicker (peer-eviction)
1502 // timer.
1503 static_assert(EXTRA_PEER_CHECK_INTERVAL < STALE_CHECK_INTERVAL, "peer eviction timer should be less than stale tip check timer");
1504 scheduler.scheduleEvery([this] { this->CheckForStaleTipAndEvictPeers(); }, std::chrono::seconds{EXTRA_PEER_CHECK_INTERVAL});
1505
1506 // schedule next run for 10-15 minutes in the future
1507 const std::chrono::milliseconds delta = 10min + GetRandMillis(5min);
1508 scheduler.scheduleFromNow([&] { ReattemptInitialBroadcast(scheduler); }, delta);
1509}
1510
1511/**
1512 * Evict orphan txn pool entries based on a newly connected

Callers 1

AppInitMainFunction · 0.80

Calls 3

scheduleEveryMethod · 0.80
scheduleFromNowMethod · 0.80

Tested by

no test coverage detected