Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add retry mechanic to worker-specific-task-queue sample #383

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yuandrew
Copy link
Contributor

@yuandrew yuandrew commented Jan 24, 2025

What was changed

Added an example of a retry mechanic to worker-specific-task-queue

Why?

Common scenario we want an example for.

Checklist

  1. Closes [Feature Request] Demonstrate retries in worker-specific-task-queue sample #376

  2. How was this tested:

Tested locally, after running a worker and the starter code. If worker goes down 5 times in a row during an activity and ScheduleToClose window passes, worker prints "Workflow failed after multiple retries" and starter code errors out.

  1. Any docs updates needed?

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking, but would like @Quinn-With-Two-Ns to look

@@ -11,6 +11,18 @@ import (
// FileProcessingWorkflow is a workflow that uses Worker-specific Task Queues to run multiple Activities on a consistent
// host.
func FileProcessingWorkflow(ctx workflow.Context) (err error) {
for attempt := 1; attempt <= 5; attempt++ {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have to, but may be worth a little comment here on why there is a loop around this whole "process".

@@ -11,6 +11,18 @@ import (
// FileProcessingWorkflow is a workflow that uses Worker-specific Task Queues to run multiple Activities on a consistent
// host.
func FileProcessingWorkflow(ctx workflow.Context) (err error) {
for attempt := 1; attempt <= 5; attempt++ {
if err = processFile(ctx); err == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably one might only retry on schedule to close timeout, but this is probably fine too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Demonstrate retries in worker-specific-task-queue sample
2 participants