11 lines
313 B
Python
11 lines
313 B
Python
|
import json
|
||
|
import redis
|
||
|
|
||
|
class RedisService:
|
||
|
def __init__(self, host: str, port: int):
|
||
|
self.client = redis.Redis(host=host, port=port, decode_responses=True)
|
||
|
|
||
|
def publish_task(self, task_data: dict):
|
||
|
channel = "audio_tasks"
|
||
|
self.client.publish(channel, json.dumps(task_data))
|