瀏覽代碼

statedb: use best pickle protocol

Ask Solem 12 年之前
父節點
當前提交
847a39da9c
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      celery/worker/state.py

+ 5 - 1
celery/worker/state.py

@@ -18,6 +18,7 @@ import shelve
 
 from collections import defaultdict
 
+from kombu.serialization import pickle_protocol
 from kombu.utils import cached_property
 
 from celery import __version__
@@ -130,6 +131,7 @@ class Persistent(object):
 
     """
     storage = shelve
+    protocol = pickle_protocol
     _is_open = False
 
     def __init__(self, filename):
@@ -152,7 +154,9 @@ class Persistent(object):
         return d
 
     def open(self):
-        return self.storage.open(self.filename, writeback=True)
+        return self.storage.open(
+            self.filename, protocol=self.protocol, writeback=True,
+        )
 
     def close(self):
         if self._is_open: