upd
All checks were successful
deploy / deploy (push) Successful in 1m33s

This commit is contained in:
Untone 2023-10-19 17:42:42 +03:00
parent fa7a04077a
commit b675188013
2 changed files with 7 additions and 8 deletions

View File

@ -3,10 +3,10 @@ from services.redis import redis
async def notify_reaction(reaction): async def notify_reaction(reaction):
channel_name = "new_reaction" channel_name = "reaction"
data = { data = {
"payload": reaction, "payload": reaction,
"kind": f"new_reaction{reaction.kind}" "action": "create"
} }
try: try:
await redis.publish(channel_name, json.dumps(data)) await redis.publish(channel_name, json.dumps(data))
@ -15,10 +15,10 @@ async def notify_reaction(reaction):
async def notify_shout(shout): async def notify_shout(shout):
channel_name = "new_shout" channel_name = "shout"
data = { data = {
"payload": shout, "payload": shout,
"kind": "new_shout" "action": "create"
} }
try: try:
await redis.publish(channel_name, json.dumps(data)) await redis.publish(channel_name, json.dumps(data))
@ -31,10 +31,10 @@ async def notify_follower(follower: dict, author_id: int):
for k in fields: for k in fields:
if k not in ["id", "name", "slug", "userpic"]: if k not in ["id", "name", "slug", "userpic"]:
del follower[k] del follower[k]
channel_name = f"followers:{author_id}" channel_name = f"follower:{author_id}"
data = { data = {
"payload": follower, "payload": follower,
"kind": "new_follower", "action": "follow",
} }
try: try:
await redis.publish(channel_name, json.dumps(data)) await redis.publish(channel_name, json.dumps(data))