Skip to content

Instantly share code, notes, and snippets.

@clayg
Created April 3, 2015 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/ae6007b4a634a3872215 to your computer and use it in GitHub Desktop.
Save clayg/ae6007b4a634a3872215 to your computer and use it in GitHub Desktop.
diff --git a/swift/account/reaper.py b/swift/account/reaper.py
index ce69fab..06a0085 100644
--- a/swift/account/reaper.py
+++ b/swift/account/reaper.py
@@ -19,6 +19,7 @@ from swift import gettext_ as _
from logging import DEBUG
from math import sqrt
from time import time
+import itertools
from eventlet import GreenPool, sleep, Timeout
@@ -432,7 +433,7 @@ class AccountReaper(Daemon):
* See also: :func:`swift.common.ring.Ring.get_nodes` for a description
of the container node dicts.
"""
- container_nodes = list(container_nodes)
+ cnodes = itertools.cycle(container_nodes)
try:
ring = self.get_object_ring(policy_index)
except PolicyError:
@@ -443,7 +444,7 @@ class AccountReaper(Daemon):
successes = 0
failures = 0
for node in nodes:
- cnode = container_nodes.pop()
+ cnode = next(cnodes)
try:
direct_delete_object(
node, part, account, container, obj,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment