Skip to content

Commit

Permalink
Avoid an infinite loop which could jam ProxyService
Browse files Browse the repository at this point in the history
If an operation with an empty dictionary of entities to create/update
was added to the queue, data[i] could become empty with task_count[i]
still being positive. Therefore no data would have ever been sent (and
thus task_count would have never been reset to zero) but the loop would
also have never yielded to other greenlets, making ProxyService stuck
(and taking up 100% of the CPU).
  • Loading branch information
lw committed May 2, 2014
1 parent 21c68fb commit 51a3a37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cms/service/ProxyService.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def run(self):
try:
for i in xrange(self.TYPE_COUNT):
# Send entities of type i.
if len(data[i]) > 0:
if task_count[i] > 0:
# XXX We abuse the resource path as the english
# (plural) name for the entity type.
name = self.RESOURCE_PATHS[i]
Expand Down

0 comments on commit 51a3a37

Please sign in to comment.