-
Notifications
You must be signed in to change notification settings - Fork 208
Fix to directly use WAIT_APPROVAL timeout #1455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| ) | ||
| defer ticker.Stop() | ||
|
|
||
| timer := time.NewTimer(time.Duration(e.StageConfig.WaitApprovalStageOptions.Timeout) * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm, the bug caused by this deleted time.Second annotation, is that right? 🤔
(Timeout default value currently set as 6h already ref: config/deployment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. It always overflows and looks like being time.NewTimer(-315919h31m53.884942336s) at runtime.
https://play.golang.org/p/WhPnXvUp7Ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I met this issue before 😂 ( time.Minute * time.Minute overflow in my case )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And one more minor question, it looks like the default value is of type Duration already, is that time.Duration(...) is necessary for the new code? 👀
ref: https://github.com/pipe-cd/pipe/pull/1455/files/a1af59eadce3ebcda7efd88f6a151f843d9026a2#diff-02a6821aa5f1210155af9610f8bb1b7683ed309d3ad56a533f0505d12ae6ffd6R57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look closely. The type of Duration used by Config is our own Type for making it easier to parse. So we have to parse it to time.Duration when using 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh, but it's a defined type based on time.Duration (ref: config/duration.go ). Still looks weird to me, but never mind if it works that way 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean
e.StageConfig.WaitApprovalStageOptions.Timeout.Duration()should be fine 😂
ref: https://github.com/pipe-cd/pipe/blob/master/pkg/config/duration.go#L25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're right, let me fix.
nakabonne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. It always overflows and looks like being time.NewTimer(-315919h31m53.884942336s) at runtime.
https://play.golang.org/p/WhPnXvUp7Ci
|
/lgtm |
|
/lgtm |
|
Nice. Thank you. |
What this PR does / why we need it:
We just need to use it directly. It could overflow.
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: