From 05975d878af796b53d4a1db449ea02a7d2204c4c Mon Sep 17 00:00:00 2001 From: James Turk Date: Mon, 27 Feb 2012 11:54:54 -0500 Subject: [PATCH] call end_request in long running threads --- oyster/tasks.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/oyster/tasks.py b/oyster/tasks.py index c14b665..c2737f8 100644 --- a/oyster/tasks.py +++ b/oyster/tasks.py @@ -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()