From 7721e3a840e295a916e20f3400d0563fc1eb1219 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Tue, 22 Apr 2025 13:03:23 +0200 Subject: [PATCH] Fix --- src/applications/temporal_worker/__main__.py | 2 +- .../twitch_webhook/activities/on_state_change.py | 6 +++--- src/core/temporal.py | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/applications/temporal_worker/__main__.py b/src/applications/temporal_worker/__main__.py index 24d3970..443d2bf 100644 --- a/src/applications/temporal_worker/__main__.py +++ b/src/applications/temporal_worker/__main__.py @@ -47,7 +47,7 @@ async def main(): twitch_activities.check_streams_states, twitch_activities.on_redemption_reward_add_activity, ], - workflow_runner=UnsandboxedWorkflowRunner(), + workflow_runner=UnsandboxedWorkflowRunner() ) await worker.run() diff --git a/src/applications/twitch_webhook/activities/on_state_change.py b/src/applications/twitch_webhook/activities/on_state_change.py index 0814d12..45f8702 100644 --- a/src/applications/twitch_webhook/activities/on_state_change.py +++ b/src/applications/twitch_webhook/activities/on_state_change.py @@ -1,12 +1,12 @@ from temporalio import activity -from dataclasses import dataclass + +from pydantic import BaseModel from applications.twitch_webhook.state import State, EventType from applications.twitch_webhook.watcher import StateWatcher -@dataclass -class OnStreamStateChangeActivity: +class OnStreamStateChangeActivity(BaseModel): streamer_id: int event_type: EventType new_state: State | None = None diff --git a/src/core/temporal.py b/src/core/temporal.py index 1baf4f9..b58ea17 100644 --- a/src/core/temporal.py +++ b/src/core/temporal.py @@ -1,5 +1,10 @@ from temporalio.client import Client +from temporalio.contrib.pydantic import pydantic_data_converter async def get_client() -> Client: - return await Client.connect("temporal:7233", namespace="default") + return await Client.connect( + "temporal:7233", + namespace="default", + data_converter=pydantic_data_converter + )