carefull...

v0.1.24 v0.1.24
Vernon Keenan 2021-01-19 17:34:28 -08:00
parent fbd1aeedc8
commit 9ecf742360
2 changed files with 18 additions and 19 deletions

View File

@ -4,6 +4,7 @@ import (
"time"
"code.tnxs.net/taxnexus/lib/app"
"go.temporal.io/sdk/temporal"
temporal_workflow "go.temporal.io/sdk/workflow"
)
@ -40,7 +41,7 @@ type NewLeadWorkflowWrapper struct {
// NewLeadWorkflow is a Temporal workflow
func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) error { //nolint:gocritic // don't care
obj := app.LeadActivityWrapper{
transferDetails := app.LeadActivityWrapper{
// Address: w.Address,
Company: w.Company,
Description: w.Description,
@ -62,27 +63,24 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) er
UTMTerm: w.UTMTerm,
Website: w.Website,
}
ctx = temporal_workflow.
WithActivityOptions(
ctx,
temporal_workflow.ActivityOptions{
retryPolicy := &temporal.RetryPolicy{
InitialInterval: time.Second,
MaximumInterval: time.Minute,
MaximumAttempts: maxAttempts,
}
options := temporal_workflow.ActivityOptions{
// Timeout options specify when to automatically timeout Actvitivy functions.
StartToCloseTimeout: time.Minute,
})
err := temporal_workflow.
ExecuteActivity(
ctx,
StoreLeadActivity,
obj,
).Get(ctx, nil)
// Optionally provide a customized RetryPolicy.
// Temporal retries failures by default, this is just an example.
RetryPolicy: retryPolicy,
}
ctx = temporal_workflow.WithActivityOptions(ctx, options)
err := temporal_workflow.ExecuteActivity(ctx, StoreLeadActivity, transferDetails).Get(ctx, nil)
if err != nil {
return err
}
err = temporal_workflow.
ExecuteActivity(
ctx,
NotifyLeadActivity,
obj,
).Get(ctx, nil)
err = temporal_workflow.ExecuteActivity(ctx, NotifyLeadActivity, transferDetails).Get(ctx, nil)
if err != nil {
return err
}

View File

@ -19,6 +19,7 @@ const getTimeout = 6 * time.Minute
// const dateTimeFormat = "2006-01-02T15:04:05-0800"
const postTimeout = 6 * time.Minute
const maxAttempts = 50
var sugar = logger.New(zapcore.InfoLevel)