Skip to content

Commit

Permalink
Исправлено сравнение текущего и нового статуса
Browse files Browse the repository at this point in the history
  • Loading branch information
Павел Сарыгин committed Feb 6, 2024
1 parent fb0cdf9 commit 408f43f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 4 additions & 2 deletions short_tracker_bot/short_tracker_bot/handlers/hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ async def get_tasks(data, chat_id, bot: Bot):
f'{chat_id}_task_{task["id"]}',
task['status']
)
if task['status'] != get_data_from_redis(
current_status = await get_data_from_redis(
f'{chat_id}_task_status_{task["id"]}'
):
)
if task['status'] != current_status:
logging.info(f'Сравнение {task["status"], current_status}')
await save_data_to_redis(
f'{chat_id}_task_status_{task["id"]}',
task["status"]
Expand Down
4 changes: 1 addition & 3 deletions short_tracker_bot/short_tracker_bot/handlers/redis_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@


async def save_data_to_redis(key, value):
logging.info(f'Сохранение в redis {key, value}')
await redis.set(key, value)


async def get_data_from_redis(key):
data = await redis.get(key)
logging.info(f'get data {data}')
return data
return data.decode('utf-8')

0 comments on commit 408f43f

Please sign in to comment.