call end_request in long running threads

This commit is contained in:
James Turk 2012-02-27 11:54:54 -05:00
parent f11b29dea3
commit 05975d878a

View File

@ -17,6 +17,8 @@ class UpdateTask(Task):
for task in doc.get('post_update_tasks', []):
send_task(hook, (doc_id,))
kernel.db.status.update({}, {'$inc': {'update_queue': -1}})
# don't sit on a connection
kernel.db.connection.end_request()
class UpdateTaskScheduler(PeriodicTask):
@ -36,3 +38,5 @@ class UpdateTaskScheduler(PeriodicTask):
for doc in next_set:
UpdateTask.delay(doc['_id'])
kernel.db.status.update({}, {'$inc': {'update_queue': 1}})
# don't sit on a connection
kernel.db.connection.end_request()