Skip to content

Commit

Permalink
remove not needed helper func
Browse files Browse the repository at this point in the history
  • Loading branch information
ychebotarev committed Dec 13, 2024
1 parent 82ab423 commit 2bf4524
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions temporalcli/commands.activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,27 +174,18 @@ func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args []
updatedOptions := updateOptionsDescribe{
TaskQueue: result.GetActivityOptions().TaskQueue.GetName(),

ScheduleToCloseTimeout: toDuration(result.GetActivityOptions().ScheduleToCloseTimeout),
ScheduleToStartTimeout: toDuration(result.GetActivityOptions().ScheduleToStartTimeout),
StartToCloseTimeout: toDuration(result.GetActivityOptions().StartToCloseTimeout),
HeartbeatTimeout: toDuration(result.GetActivityOptions().HeartbeatTimeout),
ScheduleToCloseTimeout: result.GetActivityOptions().ScheduleToCloseTimeout.AsDuration(),
ScheduleToStartTimeout: result.GetActivityOptions().ScheduleToStartTimeout.AsDuration(),
StartToCloseTimeout: result.GetActivityOptions().StartToCloseTimeout.AsDuration(),
HeartbeatTimeout: result.GetActivityOptions().HeartbeatTimeout.AsDuration(),

InitialInterval: toDuration(result.GetActivityOptions().RetryPolicy.InitialInterval),
InitialInterval: result.GetActivityOptions().RetryPolicy.InitialInterval.AsDuration(),
BackoffCoefficient: result.GetActivityOptions().RetryPolicy.BackoffCoefficient,
MaximumInterval: toDuration(result.GetActivityOptions().RetryPolicy.MaximumInterval),
MaximumInterval: result.GetActivityOptions().RetryPolicy.MaximumInterval.AsDuration(),
MaximumAttempts: result.GetActivityOptions().RetryPolicy.MaximumAttempts,
}

_ = cctx.Printer.PrintStructured(updatedOptions, printer.StructuredOptions{})

return nil
}

// Converts the duration to Go's native time.Duration.
// Returns the zero time.Duration value for nil duration.
func toDuration(duration *durationpb.Duration) (d time.Duration) {
if duration != nil {
d = duration.AsDuration()
}
return
}

0 comments on commit 2bf4524

Please sign in to comment.