Skip to content

Instantly share code, notes, and snippets.

@public
Created December 10, 2014 13:59
Show Gist options
  • Save public/f3fd19bd542d795ff3b0 to your computer and use it in GitHub Desktop.
Save public/f3fd19bd542d795ff3b0 to your computer and use it in GitHub Desktop.
class PrefetchBatches(batches.Batches):
def Strategy(self, task, app, consumer):
handler = super(PrefetchBatches, self).Strategy(task, app, consumer)
def task_handler(*args, **kwargs):
if consumer.qos.value < self.flush_every:
diff = self.flush_every - consumer.qos.value
consumer.qos.increment_eventually(diff)
return handler(*args, **kwargs)
return task_handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment