Skip to content

Commit e87daa0

Browse files
committed
Fix invalid lock usage
1 parent 9c3cd49 commit e87daa0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ldclient/impl/datasystem/store.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,36 +80,36 @@ def init(self, all_data):
8080
items_decoded[key] = kind.decode(item)
8181
all_decoded[kind] = items_decoded
8282
try:
83-
self._lock.rlock()
83+
self._lock.lock()
8484
self._items.clear()
8585
self._items.update(all_decoded)
8686
self._initialized = True
8787
for k in all_data:
8888
log.debug("Initialized '%s' store with %d items", k.namespace, len(all_data[k]))
8989
finally:
90-
self._lock.runlock()
90+
self._lock.unlock()
9191

9292
# noinspection PyShadowingNames
9393
def delete(self, kind, key: str, version: int):
9494
""" """
9595
try:
96-
self._lock.rlock()
96+
self._lock.lock()
9797
items_of_kind = self._items[kind]
9898
items_of_kind[key] = {'deleted': True, 'version': version}
9999
finally:
100-
self._lock.runlock()
100+
self._lock.unlock()
101101

102102
def upsert(self, kind, item):
103103
""" """
104104
decoded_item = kind.decode(item)
105105
key = item['key']
106106
try:
107-
self._lock.rlock()
107+
self._lock.lock()
108108
items_of_kind = self._items[kind]
109109
items_of_kind[key] = decoded_item
110110
log.debug("Updated %s in '%s' to version %d", key, kind.namespace, item['version'])
111111
finally:
112-
self._lock.runlock()
112+
self._lock.unlock()
113113

114114
@property
115115
def initialized(self) -> bool:

0 commit comments

Comments
 (0)