Skip to content

Latest commit

 

History

History
25 lines (13 loc) · 1.17 KB

README.md

File metadata and controls

25 lines (13 loc) · 1.17 KB

Infrequently Polling Activity

This sample shows how to use Activity retries for infrequent polling of a third-party service (for example via REST). This method can be used for infrequent polls of one minute or slower.

Activity retries are utilized for this option, setting the following Retry options:

  • backoff_coefficient: to 1
  • initial_interval: to the polling interval (in this sample set to 60 seconds)

This will enable the Activity to be retried exactly on the set interval.

To run, first see README.md for prerequisites.

Then, run the following from this directory to run the sample:

poetry run python run_worker.py

Then, in another terminal, run the following to execute the workflow:

poetry run python run_infrequent.py

Since the test service simulates being down for four polling attempts and then returns OK on the fifth poll attempt, the Workflow will perform four Activity retries with a 60-second poll interval, and then return the service result on the successful fifth attempt.

Note that individual Activity retries are not recorded in Workflow History, so this approach can poll for a very long time without affecting the history size.