Skip to content

Commit 5f50568

Browse files
committed
cleaned readmes
1 parent a6424f0 commit 5f50568

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

polling-frequent/README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
# Infrequently Polling Activity
1+
# Frequently Polling Activity
22

3-
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.
3+
This sample shows how we can implement frequent polling (1 second or faster) inside our Activity. The implementation is a loop that polls our service and then sleeps for the poll interval (1 second in the sample).
44

5-
Activity retries are utilized for this option, setting the following Retry options:
6-
7-
- `BackoffCoefficient`: to 1
8-
- `InitialInterval`: to the polling interval (in this sample set to 60 seconds)
9-
10-
This will enable the Activity to be retried on the set interval.
5+
To ensure that polling Activity is restarted in a timely manner, we make sure that it heartbeats on every iteration. Note that heartbeating only works if we set the `HeartbeatTimeout` to a shorter value than the Activity `StartToCloseTimeout` timeout.
116

127
### Running this sample
138

@@ -16,5 +11,7 @@ This will enable the Activity to be retried on the set interval.
1611
1. `npm run start.watch` to start the Worker.
1712
1. In another shell, `npm run workflow` to run the Workflow Client.
1813

19-
The Workflow will call the actitity and it will fail four times, then
20-
succeed on the fifth and log `Hello, Temporal!`
14+
The Workflow will call the activity and it will call the test service.
15+
The test service will either succeed or fail by generating a random number between 0 and 1:
16+
if less than .2, then it will succeed; otherwise it will fail.
17+
It logs the generated numbers, and when it succeeds, it will log `Hello, Temporal!`.

polling-infrequent/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This sample shows how to use Activity retries for infrequent polling of a third-
55
Activity retries are utilized for this option, setting the following Retry options:
66

77
- `BackoffCoefficient`: to 1
8-
- `InitialInterval`: to the polling interval (in this sample set to 60 seconds)
8+
- `InitialInterval`: to the polling interval (in this sample set to 5 seconds for convenience, but would be at least 60 seconds in real world situations)
99

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

@@ -16,5 +16,7 @@ This will enable the Activity to be retried on the set interval.
1616
1. `npm run start.watch` to start the Worker.
1717
1. In another shell, `npm run workflow` to run the Workflow Client.
1818

19-
The Workflow will call the actitity and it will fail four times, then
20-
succeed on the fifth and log `Hello, Temporal!`
19+
The Workflow will call the activity and it will call the test service.
20+
The test service will either succeed or fail by generating a random number between 0 and 1:
21+
if less than .2, then it will succeed; otherwise it will fail.
22+
It logs the generated numbers, and when it succeeds, it will log `Hello, Temporal!`.

0 commit comments

Comments
 (0)