Skip to content

Commit 9441578

Browse files
Dan feedback
1 parent aafc6b3 commit 9441578

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

polling/infrequent/activities.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
from dataclasses import dataclass
2-
31
from temporalio import activity
42

3+
from polling.infrequent.compose_greeting_input import ComposeGreetingInput
54
from polling.test_service import TestService
65

76

8-
@dataclass
9-
class ComposeGreetingInput:
10-
greeting: str
11-
name: str
12-
13-
147
@activity.defn
158
async def compose_greeting(input: ComposeGreetingInput) -> str:
169
test_service = TestService()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from dataclasses import dataclass
2+
3+
4+
@dataclass
5+
class ComposeGreetingInput:
6+
greeting: str
7+
name: str

polling/test_service.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
from polling.infrequent.compose_greeting_input import ComposeGreetingInput
2+
3+
14
class TestService:
25
def __init__(self):
36
self.error_attempts = 5
47

58
async def get_service_result(self, input: ComposeGreetingInput, attempt: int):
69
print(f"Attempt {attempt} of {self.error_attempts} to invoke service")
7-
if attempt % self.error_attempts == 0:
10+
if attempt > self.error_attempts:
811
return f"{input.greeting}, {input.name}!"
912
raise Exception("service is down")

0 commit comments

Comments
 (0)