|
|
|
@ -95,7 +95,7 @@ namespace data
@@ -95,7 +95,7 @@ namespace data
|
|
|
|
|
|
|
|
|
|
void NetDb::Run () |
|
|
|
|
{ |
|
|
|
|
uint32_t lastSave = 0, lastPublish = 0; |
|
|
|
|
uint32_t lastSave = 0, lastPublish = 0, lastKeyspaceRotation = 0; |
|
|
|
|
m_IsRunning = true; |
|
|
|
|
while (m_IsRunning) |
|
|
|
|
{ |
|
|
|
@ -142,6 +142,11 @@ namespace data
@@ -142,6 +142,11 @@ namespace data
|
|
|
|
|
Publish (); |
|
|
|
|
lastPublish = ts; |
|
|
|
|
} |
|
|
|
|
if (ts % 86400 < 60 && ts - lastKeyspaceRotation >= 60) // wihhin 1 minutes since midnight (86400 = 24*3600)
|
|
|
|
|
{ |
|
|
|
|
KeyspaceRotation (); |
|
|
|
|
lastKeyspaceRotation = ts; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (std::exception& ex) |
|
|
|
|
{ |
|
|
|
@ -724,5 +729,13 @@ namespace data
@@ -724,5 +729,13 @@ namespace data
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void NetDb::KeyspaceRotation () |
|
|
|
|
{ |
|
|
|
|
for (auto it: m_RouterInfos) |
|
|
|
|
it.second->UpdateRoutingKey (); |
|
|
|
|
LogPrint ("Keyspace rotation complete"); |
|
|
|
|
Publish (); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|