toRetryParameters converts RetryOptions to pb.TaskQueueRetryParameters.
()
| 64 | |
| 65 | // toRetryParameters converts RetryOptions to pb.TaskQueueRetryParameters. |
| 66 | func (opt *RetryOptions) toRetryParameters() *pb.TaskQueueRetryParameters { |
| 67 | params := &pb.TaskQueueRetryParameters{} |
| 68 | if opt.RetryLimit > 0 { |
| 69 | params.RetryLimit = proto.Int32(opt.RetryLimit) |
| 70 | } |
| 71 | if opt.AgeLimit > 0 { |
| 72 | params.AgeLimitSec = proto.Int64(int64(opt.AgeLimit.Seconds())) |
| 73 | } |
| 74 | if opt.MinBackoff > 0 { |
| 75 | params.MinBackoffSec = proto.Float64(opt.MinBackoff.Seconds()) |
| 76 | } |
| 77 | if opt.MaxBackoff > 0 { |
| 78 | params.MaxBackoffSec = proto.Float64(opt.MaxBackoff.Seconds()) |
| 79 | } |
| 80 | if opt.MaxDoublings > 0 || (opt.MaxDoublings == 0 && opt.ApplyZeroMaxDoublings) { |
| 81 | params.MaxDoublings = proto.Int32(opt.MaxDoublings) |
| 82 | } |
| 83 | return params |
| 84 | } |
| 85 | |
| 86 | // A Task represents a task to be executed. |
| 87 | type Task struct { |