mirror of
https://github.com/kurbezz/discord-bot.git
synced 2025-12-06 15:15:37 +01:00
Add on_stream_state_change retries
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from taskiq import TaskiqScheduler
|
||||
from taskiq.middlewares.retry_middleware import SimpleRetryMiddleware
|
||||
from taskiq.schedule_sources import LabelScheduleSource
|
||||
from taskiq_redis import ListQueueBroker, RedisAsyncResultBackend
|
||||
|
||||
@@ -6,6 +7,9 @@ from core.config import config
|
||||
|
||||
|
||||
broker = ListQueueBroker(url=config.REDIS_URI) \
|
||||
.with_middlewares(
|
||||
SimpleRetryMiddleware(default_retry_count=5)
|
||||
) \
|
||||
.with_result_backend(RedisAsyncResultBackend(
|
||||
redis_url=config.REDIS_URI,
|
||||
result_ex_time=60 * 60 * 24 * 7,
|
||||
|
||||
@@ -8,7 +8,10 @@ from .watcher import StateWatcher
|
||||
from .twitch.authorize import authorize
|
||||
|
||||
|
||||
@broker.task("stream_notifications.twitch.on_stream_state_change")
|
||||
@broker.task(
|
||||
"stream_notifications.twitch.on_stream_state_change",
|
||||
retry_on_error=True
|
||||
)
|
||||
async def on_stream_state_change(
|
||||
streamer_id: int, new_state: State | None = None
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user