Skip to content

Conversation

@nakabonne
Copy link
Member

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?:

NONE

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 33.49%. This pull request does not change code coverage.

)
defer ticker.Stop()

timer := time.NewTimer(time.Duration(e.StageConfig.WaitApprovalStageOptions.Timeout) * time.Second)
Copy link
Member

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)

Copy link
Member Author

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

Copy link
Member

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 )

Copy link
Member

@khanhtc1202 khanhtc1202 Jan 21, 2021

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

Copy link
Member Author

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 😄

Copy link
Member

@khanhtc1202 khanhtc1202 Jan 21, 2021

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 😅

Copy link
Member

@khanhtc1202 khanhtc1202 Jan 21, 2021

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

Copy link
Member Author

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.

Copy link
Member Author

@nakabonne nakabonne left a 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

@khanhtc1202
Copy link
Member

/lgtm

@pipecd-bot pipecd-bot removed the lgtm label Jan 21, 2021
@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 33.49%. This pull request does not change code coverage.

@khanhtc1202
Copy link
Member

/lgtm

@nghialv
Copy link
Member

nghialv commented Jan 21, 2021

Nice. Thank you.
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by nghialv.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

@pipecd-bot pipecd-bot merged commit 0d76be2 into master Jan 21, 2021
@pipecd-bot pipecd-bot deleted the fix-waitapproval-timeout branch January 21, 2021 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants