Permalink
Browse files

use multiprocessing instead of threading

this plays nicely with gunicorn
  • Loading branch information...
1 parent 60ce695 commit 204153defc97c6688b51ad02bed89aa04671bbda @dound committed Feb 2, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 couchbase/couchbaseclient.py
@@ -15,8 +15,8 @@
# limitations under the License.
#
-from Queue import Queue, Full, Empty
-from threading import Thread, Event, Lock
+from multiprocessing import Queue, Event, Lock, Process
+from Queue import Full, Empty
from exception import MemcachedTimeoutException, InvalidArgumentException
import logger
@@ -649,10 +649,10 @@ def __init__(self, url, bucket, password="", verbose=False):
self.reconfig_vbucket_map()
self.init_vbucket_connections()
self.dispatcher = CommandDispatcher(self)
- self.dispatcher_thread = Thread(name="dispatcher-thread", target=self._start_dispatcher)
+ self.dispatcher_thread = Process(name="dispatcher-thread", target=self._start_dispatcher)
self.dispatcher_thread.daemon = True
self.dispatcher_thread.start()
- self.streaming_thread = Thread(name="streaming", target=self._start_streaming, args=())
+ self.streaming_thread = Process(name="streaming", target=self._start_streaming, args=())
self.streaming_thread.daemon = True
self.streaming_thread.start()
self.verbose = verbose

0 comments on commit 204153d

Please sign in to comment.