Thomas Vachuska
Committed by Brian O'Connor

ONOS-4590 Added back-off mechanism for intent clean-up.

Change-Id: If997943aef8e46caafd21629296b939d6669e374
......@@ -86,6 +86,7 @@ public class IntentCleanup implements Runnable, IntentListener {
private ExecutorService executor;
private Timer timer;
private TimerTask timerTask;
private int cleanupIteration = 0;
@Activate
public void activate() {
......@@ -188,6 +189,11 @@ public class IntentCleanup implements Runnable, IntentListener {
}
private void resubmitPendingRequest(IntentData intentData) {
if (cleanupIteration % (intentData.errorCount() + 1) != 0) {
// backoff
return;
}
switch (intentData.request()) {
case INSTALL_REQ:
service.submit(intentData.intent());
......@@ -210,6 +216,8 @@ public class IntentCleanup implements Runnable, IntentListener {
* re-submit/withdraw appropriately.
*/
private void cleanup() {
cleanupIteration++;
int corruptCount = 0, failedCount = 0, stuckCount = 0, pendingCount = 0;
for (IntentData intentData : store.getIntentData(true, periodMs)) {
......