Merge pull request #421 from pigmej/fix-gevent-errors
Fixed gevent related test failures
This commit is contained in:
commit
501a1899e3
@ -181,6 +181,7 @@ def requires_clean_state(_type):
|
|||||||
|
|
||||||
|
|
||||||
def check_state_for(_type, obj):
|
def check_state_for(_type, obj):
|
||||||
|
with obj._lock:
|
||||||
state = obj._c.db_ch_state.get(_type)
|
state = obj._c.db_ch_state.get(_type)
|
||||||
if state:
|
if state:
|
||||||
if True:
|
if True:
|
||||||
@ -731,6 +732,8 @@ class Model(object):
|
|||||||
|
|
||||||
_local = get_local()()
|
_local = get_local()()
|
||||||
|
|
||||||
|
_lock = RLock() # for class objs
|
||||||
|
|
||||||
def __init__(self, key=None):
|
def __init__(self, key=None):
|
||||||
self._modified_fields = set()
|
self._modified_fields = set()
|
||||||
# TODO: that _indexes_changed should be smarter
|
# TODO: that _indexes_changed should be smarter
|
||||||
@ -853,6 +856,10 @@ class Model(object):
|
|||||||
raise DBLayerException("Object already exists in cache"
|
raise DBLayerException("Object already exists in cache"
|
||||||
" cannot create second")
|
" cannot create second")
|
||||||
data['key'] = key
|
data['key'] = key
|
||||||
|
|
||||||
|
with cls._c.obj_cache._lock:
|
||||||
|
if key in cls._c.obj_cache:
|
||||||
|
return cls._c.obj_cache.get(key)
|
||||||
riak_obj = cls.bucket.new(key, data={})
|
riak_obj = cls.bucket.new(key, data={})
|
||||||
obj = cls.from_riakobj(riak_obj)
|
obj = cls.from_riakobj(riak_obj)
|
||||||
obj._new = True
|
obj._new = True
|
||||||
|
@ -398,12 +398,12 @@ class InputsFieldWrp(IndexFieldWrp):
|
|||||||
return self._cache[full_name]
|
return self._cache[full_name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
with self.inputs_index_cache as c:
|
||||||
check_state_for('index', self._instance)
|
check_state_for('index', self._instance)
|
||||||
fname = self.fname
|
fname = self.fname
|
||||||
my_name = self._instance.key
|
my_name = self._instance.key
|
||||||
self._has_own_input(name)
|
self._has_own_input(name)
|
||||||
ind_name = '{}_recv_bin'.format(fname)
|
ind_name = '{}_recv_bin'.format(fname)
|
||||||
with self.inputs_index_cache as c:
|
|
||||||
kwargs = dict(startkey='{}|'.format(my_name),
|
kwargs = dict(startkey='{}|'.format(my_name),
|
||||||
endkey='{}|~'.format(my_name),
|
endkey='{}|~'.format(my_name),
|
||||||
return_terms=True)
|
return_terms=True)
|
||||||
|
@ -9,3 +9,6 @@ os-testr
|
|||||||
|
|
||||||
# for computable inputs
|
# for computable inputs
|
||||||
lupa
|
lupa
|
||||||
|
|
||||||
|
# to test if everything works on gevent
|
||||||
|
gevent
|
||||||
|
Loading…
Reference in New Issue
Block a user