When should one use activity heartbeating and when is it okay not to use it?
If an activity is long running then it should heartbeat back to the server. Some of the situations where heartbeat helps:
- Activity needs to report progress so in case of failures it can be retried from last reported progress.
- Activity runs for a long time (very large startToClose timeout). Activity in this case can heartbeat with a smaller heartbeat timeout so it can be retried earlier in the case of failure instead of waiting on startToClose timeout.
- RequestCancel for activity is also dispatched to activity on heartbeat.
This is a good example of a use-case which requires heartbeat: What is the best practice for a polling activity?