33
44from ldclient .impl .dependency_tracker import DependencyTracker , KindAndKey
55from ldclient .impl .listeners import Listeners
6- from ldclient .impl .rwlock import ReadWriteLock
76from ldclient .interfaces import (
87 AsyncDataSourceUpdateSink ,
98 AsyncFeatureStore ,
@@ -23,13 +22,11 @@ def __init__(self, store: AsyncFeatureStore, status_listeners: Listeners, flag_c
2322 self .__flag_change_listeners = flag_change_listeners
2423 self .__tracker = DependencyTracker ()
2524
26- self .__lock = ReadWriteLock ()
2725 self .__status = DataSourceStatus (DataSourceState .INITIALIZING , time .time (), None )
2826
2927 @property
3028 def status (self ) -> DataSourceStatus :
31- with self .__lock .read ():
32- return self .__status
29+ return self .__status
3330
3431 async def init (self , all_data : Mapping [VersionedDataKind , Mapping [str , dict ]]) -> None :
3532 old_data : Optional [Dict [VersionedDataKind , Mapping [str , dict ]]] = None
@@ -73,22 +70,21 @@ async def delete(self, kind: VersionedDataKind, key: str, version: int) -> None:
7370 def update_status (self , new_state : DataSourceState , new_error : Optional [DataSourceErrorInfo ]) -> None :
7471 status_to_broadcast = None
7572
76- with self .__lock .write ():
77- old_status = self .__status
73+ old_status = self .__status
7874
79- if new_state == DataSourceState .INTERRUPTED and old_status .state == DataSourceState .INITIALIZING :
80- new_state = DataSourceState .INITIALIZING
75+ if new_state == DataSourceState .INTERRUPTED and old_status .state == DataSourceState .INITIALIZING :
76+ new_state = DataSourceState .INITIALIZING
8177
82- if new_state == old_status .state and new_error is None :
83- return
78+ if new_state == old_status .state and new_error is None :
79+ return
8480
85- self .__status = DataSourceStatus (
86- new_state ,
87- self .__status .since if new_state == self .__status .state else time .time (),
88- self .__status .error if new_error is None else new_error ,
89- )
81+ self .__status = DataSourceStatus (
82+ new_state ,
83+ self .__status .since if new_state == self .__status .state else time .time (),
84+ self .__status .error if new_error is None else new_error ,
85+ )
9086
91- status_to_broadcast = self .__status
87+ status_to_broadcast = self .__status
9288
9389 if status_to_broadcast is not None :
9490 self .__status_listeners .notify (status_to_broadcast )
0 commit comments