mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* fix: refactor activity options declaration * fix: increase uninstall storage activities' timeout across the board * fix: make payments_delete_from_connector_id use batches + hearthbeat + higher temporal timeout * fix: make instances, accounts and schedule use batche deletion too * fix: refactored activity batch deletion, also batch event_sent deletion * fix: forgot to change back the batch size after manual testing * fix: ensure batchsize >0
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package workflow
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/formancehq/payments/internal/models"
|
|
"go.temporal.io/sdk/temporal"
|
|
"go.temporal.io/sdk/workflow"
|
|
)
|
|
|
|
func infiniteRetryContext(ctx workflow.Context) workflow.Context {
|
|
return infiniteRetryWithCustomStartToCloseAndHeartbeatContext(
|
|
ctx,
|
|
models.ActivityStartToCloseTimeoutMinutesDefault*time.Minute,
|
|
time.Duration(0),
|
|
)
|
|
}
|
|
|
|
func infiniteRetryWithLongTimeoutContext(ctx workflow.Context) workflow.Context {
|
|
return infiniteRetryWithCustomStartToCloseAndHeartbeatContext(
|
|
ctx,
|
|
models.ActivityStartToCloseTimeoutMinutesLong*time.Minute,
|
|
time.Duration(0),
|
|
)
|
|
}
|
|
|
|
func infiniteRetryWithCustomStartToCloseAndHeartbeatContext(ctx workflow.Context, startToCloseTimeout, heartbeatTimeout time.Duration) workflow.Context {
|
|
ao := workflow.ActivityOptions{
|
|
RetryPolicy: &temporal.RetryPolicy{
|
|
InitialInterval: time.Second,
|
|
BackoffCoefficient: 2,
|
|
MaximumInterval: 100 * time.Second,
|
|
NonRetryableErrorTypes: []string{},
|
|
},
|
|
}
|
|
if startToCloseTimeout != time.Duration(0) {
|
|
ao.StartToCloseTimeout = startToCloseTimeout
|
|
}
|
|
if heartbeatTimeout != time.Duration(0) {
|
|
ao.HeartbeatTimeout = heartbeatTimeout
|
|
}
|
|
|
|
return workflow.WithActivityOptions(ctx, ao)
|
|
}
|