mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-10 22:00:55 +08:00
Initial work on fix for #424 - TypeError: can't pickle _thread.lock objects.
Made `Broker` and `Queue` classes pickable which fixes the the problem with new default `spawn` proces start method.
This commit is contained in:
@@ -13,6 +13,14 @@ class Broker:
|
||||
self.cache = self.get_cache()
|
||||
self._info = None
|
||||
|
||||
def __getstate__(self):
|
||||
return self.list_key, self._info
|
||||
|
||||
def __setstate__(self, state):
|
||||
self.list_key, self._info = state
|
||||
self.connection = self.get_connection(self.list_key)
|
||||
self.cache = self.get_cache()
|
||||
|
||||
def enqueue(self, task):
|
||||
"""
|
||||
Puts a task onto the queue
|
||||
|
||||
Reference in New Issue
Block a user