mirror of
https://github.com/kurbezz/discord-bot.git
synced 2026-03-04 19:10:48 +01:00
Fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from .sync import ScheduleSyncActivity
|
||||
from .sync import syncronize
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ScheduleSyncActivity",
|
||||
"syncronize",
|
||||
]
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
from temporalio import activity
|
||||
|
||||
from applications.common.repositories.streamers import StreamerConfigRepository
|
||||
from applications.schedule_sync.synchronizer import syncronize
|
||||
from applications.schedule_sync.synchronizer import syncronize as syncronize_internal
|
||||
|
||||
|
||||
class ScheduleSyncActivity:
|
||||
@classmethod
|
||||
@activity.defn
|
||||
async def syncronize(cls, twitch_id: int):
|
||||
streamer = await StreamerConfigRepository.get_by_twitch_id(twitch_id)
|
||||
@activity.defn
|
||||
async def syncronize(twitch_id: int):
|
||||
streamer = await StreamerConfigRepository.get_by_twitch_id(twitch_id)
|
||||
|
||||
if streamer.integrations.discord is None:
|
||||
return
|
||||
if streamer.integrations.discord is None:
|
||||
return
|
||||
|
||||
await syncronize(streamer.twitch, streamer.integrations.discord.guild_id)
|
||||
await syncronize_internal(streamer.twitch, streamer.integrations.discord.guild_id)
|
||||
|
||||
@@ -4,10 +4,8 @@ from temporalio import workflow
|
||||
from temporalio.client import Schedule, ScheduleActionStartWorkflow, ScheduleSpec, ScheduleIntervalSpec
|
||||
|
||||
from applications.common.repositories.streamers import StreamerConfigRepository
|
||||
from applications.schedule_sync.activities import ScheduleSyncActivity
|
||||
|
||||
|
||||
TASK_QUEUE = "main"
|
||||
from applications.schedule_sync.activities import syncronize
|
||||
from applications.temporal_worker.queues import MAIN_QUEUE
|
||||
|
||||
|
||||
@workflow.defn
|
||||
@@ -19,7 +17,7 @@ class ScheduleSyncWorkflow:
|
||||
action=ScheduleActionStartWorkflow(
|
||||
cls.run,
|
||||
id="ScheduleSyncWorkflow",
|
||||
task_queue=TASK_QUEUE,
|
||||
task_queue=MAIN_QUEUE,
|
||||
),
|
||||
spec=ScheduleSpec(
|
||||
intervals=[ScheduleIntervalSpec(every=timedelta(minutes=5))]
|
||||
@@ -35,7 +33,7 @@ class ScheduleSyncWorkflow:
|
||||
if streamer.integrations.discord is None:
|
||||
continue
|
||||
|
||||
await workflow.execute_activity_method(
|
||||
ScheduleSyncActivity.syncronize,
|
||||
await workflow.execute_activity(
|
||||
syncronize,
|
||||
streamer.twitch.id
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user