Coverage for apps/outers/datastores/two_datastore.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-22 19:03 +0000

1from redis import Redis as SyncRedis 

2from redis.asyncio import Redis as AsyncRedis 

3 

4from apps.outers.settings.two_datastore_setting import TwoDatastoreSetting 

5 

6 

7class TwoDatastore: 

8 

9 def __init__( 

10 self, 

11 two_datastore_setting: TwoDatastoreSetting 

12 ): 

13 self.two_datastore_setting: TwoDatastoreSetting = two_datastore_setting 

14 self.async_client: AsyncRedis = AsyncRedis.from_url( 

15 url=self.two_datastore_setting.URL, 

16 health_check_interval=10, 

17 retry_on_timeout=True, 

18 socket_keepalive=True 

19 ) 

20 self.sync_client: SyncRedis = SyncRedis.from_url( 

21 url=self.two_datastore_setting.URL, 

22 health_check_interval=10, 

23 retry_on_timeout=True, 

24 socket_keepalive=True 

25 )