Merge ~troyanov/maas:power-activity-retry-policy into maas:master

Proposed by Anton Troyanov
Status: Merged
Approved by: Anton Troyanov
Approved revision: 3e27eb2caedf649cebe06e166f14cc14d81faf6a
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~troyanov/maas:power-activity-retry-policy
Merge into: maas:master
Diff against target: 22 lines (+4/-0)
1 file modified
src/maasagent/internal/workflow/power.go (+4/-0)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Alberto Donato (community) Approve
Review via email: mp+455043@code.launchpad.net

Commit message

fix: set maximum attempts for power activity

We don't want Activities to be retried forever.

> Maximum number of attempts. When exceeded the retries stop even if not expired yet.
> If not set or set to 0, it means unlimited, and rely on activity ScheduleToCloseTimeout to stop.

To post a comment you must log in.
Revision history for this message
Alberto Donato (ack) wrote :

+1

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b power-activity-retry-policy lp:~troyanov/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 3e27eb2caedf649cebe06e166f14cc14d81faf6a

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasagent/internal/workflow/power.go b/src/maasagent/internal/workflow/power.go
2index 298df45..30c5240 100644
3--- a/src/maasagent/internal/workflow/power.go
4+++ b/src/maasagent/internal/workflow/power.go
5@@ -12,6 +12,7 @@ import (
6 "time"
7
8 "go.temporal.io/sdk/activity"
9+ "go.temporal.io/sdk/temporal"
10 "go.temporal.io/sdk/workflow"
11 "maas.io/core/src/maasagent/internal/workflow/log/tag"
12 )
13@@ -160,6 +161,9 @@ func PowerActivity(ctx context.Context, params PowerActivityParam) (*PowerResult
14 func execPowerActivity(ctx workflow.Context, params PowerActivityParam) workflow.Future {
15 ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
16 StartToCloseTimeout: powerActivityDuration,
17+ RetryPolicy: &temporal.RetryPolicy{
18+ MaximumAttempts: 5,
19+ },
20 })
21
22 return workflow.ExecuteActivity(ctx, PowerActivity, params)

Subscribers

People subscribed via source and target branches