Skip to content

Commit

Permalink
Remove loop from infrequent polling
Browse files Browse the repository at this point in the history
Fixes #90
  • Loading branch information
cretz committed Nov 9, 2023
1 parent 8664134 commit f961e13
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions polling/infrequent/activities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
from dataclasses import dataclass

from temporalio import activity
Expand All @@ -15,9 +14,6 @@ class ComposeGreetingInput:
@activity.defn
async def compose_greeting(input: ComposeGreetingInput) -> str:
test_service = TestService()
while True:
try:
result = test_service.get_service_result(input)
return result
except Exception:
activity.heartbeat("Invoking activity")
# If this raises an exception because it's not done yet, the activity will
# continually be scheduled for retry
return await test_service.get_service_result(input)

0 comments on commit f961e13

Please sign in to comment.