Skip to content

Commit

Permalink
Merge pull request #223 from openvstorage/0.1.x_gevent_threading
Browse files Browse the repository at this point in the history
ArakoonClientPool does not work well in a threaded context and requires monkeypatching
  • Loading branch information
sjovdnbos authored Apr 4, 2019
2 parents 7efc30a + d030230 commit 1aa276f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/db/arakoon/pyrakoon/client/client_pooled.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ class PyrakoonClientPooled(PyrakoonBase):
"""
Pooled arakoon client wrapper
Exposes the same API as the base PyrakoonClient while using a pool underneath
NOTE: this client won't work in a thread except the main thread when not monkey patching gevent
Monkey patching can be done using
from gevent import monkey
monkey.patch_all()
This has to be called at the start of the application.
"""

_logger = Logger('extensions')
Expand Down
4 changes: 2 additions & 2 deletions src/storage/persistent/pyrakoonstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from ConfigParser import RawConfigParser
from functools import wraps
from StringIO import StringIO
from ovs_extensions.db.arakoon.pyrakoon.client import PyrakoonClient, PyrakoonClientPooled
from ovs_extensions.db.arakoon.pyrakoon.client import PyrakoonClient
from ovs_extensions.db.arakoon.pyrakoon.pyrakoon.compat import ArakoonAssertionFailed, ArakoonNotFound
from ovs_extensions.storage.exceptions import AssertException, KeyNotFoundException

Expand Down Expand Up @@ -66,7 +66,7 @@ def __init__(self, cluster, configuration):
for node in parser.get('global', 'cluster').split(','):
node = node.strip()
nodes[node] = ([parser.get(node, 'ip')], parser.get(node, 'client_port'))
self._client = PyrakoonClientPooled(cluster, nodes)
self._client = PyrakoonClient(cluster, nodes)

@convert_exception()
def get(self, key):
Expand Down

0 comments on commit 1aa276f

Please sign in to comment.