NetDB: RI Publish improvements part 1

This commit is contained in:
zzz
2025-01-27 18:15:30 +00:00
parent cd721772f1
commit 456a748696
2 changed files with 8 additions and 3 deletions

View File

@@ -926,7 +926,7 @@ public class Router implements RouterClock.ClockShiftListener {
changed = true;
}
}
if (_context.netDb().isInitialized()) {
if (changed && _context.netDb().isInitialized()) {
if (_log.shouldWarn())
_log.warn("NetDB ready, publishing RI");
// any previous calls to netdb().publish() did not

View File

@@ -89,8 +89,9 @@ public class PersistentDataStore extends TransientDataStore {
writer.start();
}
// We use ReadJob.isNetDbReady() so publish() will work before the initial ReadJob is complete
@Override
public boolean isInitialized() { return _initialized; }
public boolean isInitialized() { return _initialized || _readJob.isNetDbReady(); }
// this doesn't stop the read job or the writer, maybe it should?
@Override
@@ -411,6 +412,10 @@ public class PersistentDataStore extends TransientDataStore {
requeue(0);
}
public boolean isNetDbReady() {
return _setNetDbReady;
}
private void readFiles() {
int routerCount = 0;
@@ -490,7 +495,7 @@ public class PersistentDataStore extends TransientDataStore {
if (_facade.reseedChecker().checkReseed(routerCount)) {
_lastReseed = _context.clock().now();
// checkReseed will call wakeup() when done and we will run again
} else {
} else if (!_setNetDbReady) {
_setNetDbReady = true;
_context.router().setNetDbReady();
}