mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-28 20:47:49 +01:00
Server: connected event only if really connecting
This commit is contained in:
@@ -118,13 +118,13 @@ public class PeerManager {
|
||||
return null;
|
||||
});
|
||||
|
||||
for (var l : _connectedListeners) {
|
||||
l.apply(host);
|
||||
}
|
||||
|
||||
if (wasReachable) return;
|
||||
|
||||
Log.info("Connected to " + host);
|
||||
|
||||
for (var l : _connectedListeners) {
|
||||
l.apply(host);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleConnectionError(UUID host) {
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.usatiuk.dhfs.objects.repository.PeerManager;
|
||||
import io.quarkus.logging.Log;
|
||||
import io.quarkus.runtime.ShutdownEvent;
|
||||
import io.quarkus.runtime.StartupEvent;
|
||||
import io.quarkus.scheduler.Scheduled;
|
||||
import io.smallrye.common.annotation.Blocking;
|
||||
import jakarta.annotation.Priority;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.enterprise.event.Observes;
|
||||
@@ -41,7 +43,6 @@ public class DeferredInvalidationQueueService {
|
||||
Log.warn("Reading invalidation queue from backup");
|
||||
_persistentData = SerializationHelper.deserialize(Files.readAllBytes(Paths.get(dataRoot).resolve(dataFileName)));
|
||||
}
|
||||
|
||||
remoteHostManager.registerConnectEventListener(this::returnForHost);
|
||||
}
|
||||
|
||||
@@ -63,6 +64,14 @@ public class DeferredInvalidationQueueService {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME:
|
||||
@Scheduled(every = "15s", concurrentExecution = Scheduled.ConcurrentExecution.SKIP)
|
||||
@Blocking
|
||||
void periodicReturn() {
|
||||
for (var reachable : remoteHostManager.getAvailableHosts())
|
||||
returnForHost(reachable);
|
||||
}
|
||||
|
||||
void returnForHost(UUID host) {
|
||||
synchronized (this) {
|
||||
var col = _persistentData.getDeferredInvalidations().get(host);
|
||||
|
||||
Reference in New Issue
Block a user