| 1495 | } |
| 1496 | |
| 1497 | void 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 |
no test coverage detected