File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
packages/service-library/src/servicelib/long_running_tasks/_store Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1- import json
21from typing import Any , Final
32
43import redis .asyncio as aioredis
4+ from common_library .json_serialization import json_dumps , json_loads
55from pydantic import TypeAdapter
66from settings_library .redis import RedisDatabase , RedisSettings
77
@@ -66,17 +66,17 @@ async def delete_task_data(self, task_id: TaskId) -> None:
6666 async def set_as_cancelled (
6767 self , task_id : TaskId , with_task_context : TaskContext | None
6868 ) -> None :
69-
70- value = None if with_task_context is None else json .dumps (with_task_context )
7169 await self .redis .hset (
72- self ._get_redis_hash_key (STORE_TYPE_CANCELLED_TASKS ), task_id , value
70+ self ._get_redis_hash_key (STORE_TYPE_CANCELLED_TASKS ),
71+ task_id ,
72+ json_dumps (with_task_context ),
7373 )
7474
7575 async def get_cancelled (self ) -> dict [TaskId , TaskContext | None ]:
7676 result : dict [str , str | None ] = await self .redis .hgetall (
7777 self ._get_redis_hash_key (STORE_TYPE_CANCELLED_TASKS )
7878 )
7979 return {
80- task_id : (json . loads (context ) if context else None )
80+ task_id : (json_loads (context ) if context else None )
8181 for task_id , context in result .items ()
8282 }
You can’t perform that action at this time.
0 commit comments