ONOS-7420 workaround for DCS event consolidation bug
Change-Id: I5dda431407e6efdba0fe948bf84aa9b06a9e0f35
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizer.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizer.java
index 0d48e19..f5a8135 100644
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizer.java
+++ b/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizer.java
@@ -22,6 +22,7 @@
import static org.onosproject.d.config.sync.operation.SetResponse.response;
import static org.slf4j.LoggerFactory.getLogger;
+import java.time.Duration;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -89,6 +90,10 @@
private DynamicConfigListener listener = new InnerDyConListener();
+ // FIXME hack for unconsolidated event bug
+ private Duration quietPeriod = Duration.ofSeconds(2);
+ private long quietUntil = 0;
+
@Activate
public void activate() {
// TODO start background task to sync Controller and Device?
@@ -163,6 +168,12 @@
}
void processEventNonBatch(DynamicConfigEvent event) {
+ if (System.currentTimeMillis() < quietUntil) {
+ log.trace("Ignoring {}. Quiet period until {}",
+ event, Tools.defaultOffsetDataTime(quietUntil));
+ return;
+ }
+
ResourceId path = event.subject();
if (isUnderDeviceRootNode(path)) {
log.trace("processing event:{}", event);
@@ -209,6 +220,9 @@
log.error("Request to {} failed {}", deviceId, response, e);
}
});
+
+ // FIXME hack for unconsolidated event bug
+ quietUntil = System.currentTimeMillis() + quietPeriod.toMillis();
} else {
log.warn("Ignored event's ResourceId: {}", event.subject());
}