Committed by
Brian O'Connor
ONOS-4590 Added back-off mechanism for intent clean-up.
Change-Id: If997943aef8e46caafd21629296b939d6669e374
Showing
1 changed file
with
8 additions
and
0 deletions
... | @@ -86,6 +86,7 @@ public class IntentCleanup implements Runnable, IntentListener { | ... | @@ -86,6 +86,7 @@ public class IntentCleanup implements Runnable, IntentListener { |
86 | private ExecutorService executor; | 86 | private ExecutorService executor; |
87 | private Timer timer; | 87 | private Timer timer; |
88 | private TimerTask timerTask; | 88 | private TimerTask timerTask; |
89 | + private int cleanupIteration = 0; | ||
89 | 90 | ||
90 | @Activate | 91 | @Activate |
91 | public void activate() { | 92 | public void activate() { |
... | @@ -188,6 +189,11 @@ public class IntentCleanup implements Runnable, IntentListener { | ... | @@ -188,6 +189,11 @@ public class IntentCleanup implements Runnable, IntentListener { |
188 | } | 189 | } |
189 | 190 | ||
190 | private void resubmitPendingRequest(IntentData intentData) { | 191 | private void resubmitPendingRequest(IntentData intentData) { |
192 | + if (cleanupIteration % (intentData.errorCount() + 1) != 0) { | ||
193 | + // backoff | ||
194 | + return; | ||
195 | + } | ||
196 | + | ||
191 | switch (intentData.request()) { | 197 | switch (intentData.request()) { |
192 | case INSTALL_REQ: | 198 | case INSTALL_REQ: |
193 | service.submit(intentData.intent()); | 199 | service.submit(intentData.intent()); |
... | @@ -210,6 +216,8 @@ public class IntentCleanup implements Runnable, IntentListener { | ... | @@ -210,6 +216,8 @@ public class IntentCleanup implements Runnable, IntentListener { |
210 | * re-submit/withdraw appropriately. | 216 | * re-submit/withdraw appropriately. |
211 | */ | 217 | */ |
212 | private void cleanup() { | 218 | private void cleanup() { |
219 | + cleanupIteration++; | ||
220 | + | ||
213 | int corruptCount = 0, failedCount = 0, stuckCount = 0, pendingCount = 0; | 221 | int corruptCount = 0, failedCount = 0, stuckCount = 0, pendingCount = 0; |
214 | 222 | ||
215 | for (IntentData intentData : store.getIntentData(true, periodMs)) { | 223 | for (IntentData intentData : store.getIntentData(true, periodMs)) { | ... | ... |
-
Please register or login to post a comment