mirror of
https://github.com/XTXMarkets/ternfs.git
synced 2026-05-07 12:52:00 -05:00
registry: min cycle interval for BlockServiceFileTracker
This commit is contained in:
@@ -76,6 +76,11 @@ void BlockServiceFileTracker::_processResponses() {
|
||||
|
||||
void BlockServiceFileTracker::_scanBlockServices() {
|
||||
if (_blockServiceState.empty() && _pendingBlockServices.empty()) {
|
||||
auto now = ternNow();
|
||||
if (now - _lastScanCycleComplete < MIN_SCAN_CYCLE_INTERVAL) {
|
||||
return;
|
||||
}
|
||||
_lastScanCycleComplete = now;
|
||||
LOG_INFO(_env, "Scanning for block services to track");
|
||||
_registryDB.blockServices(_pendingBlockServices);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
static constexpr uint32_t MAX_BLOCK_SERVICE_SCAN = 128;
|
||||
static constexpr uint32_t MAX_SHARD_RESPONSES = 2*MAX_BLOCK_SERVICE_SCAN;
|
||||
static constexpr Duration SHARD_RETRY_TIMEOUT = 1_sec;
|
||||
static constexpr Duration MIN_SCAN_CYCLE_INTERVAL = 15_mins;
|
||||
|
||||
BlockServiceFileTracker(Logger& logger, std::shared_ptr<XmonAgent>& xmon, const RegistryOptions& options, RegistryDB& db, RegistryServer& server, RegistryWriter& writer);
|
||||
|
||||
@@ -51,6 +52,7 @@ private:
|
||||
std::unordered_map<BlockServiceId, BlockServiceStatus> _blockServiceState;
|
||||
std::vector<FullBlockServiceInfo> _pendingBlockServices;
|
||||
ShardId _currentShardIndex = 0;
|
||||
TernTime _lastScanCycleComplete = 0;
|
||||
|
||||
void _processResponses();
|
||||
void _scanBlockServices();
|
||||
|
||||
Reference in New Issue
Block a user