-
Notifications
You must be signed in to change notification settings - Fork 38
Conversation
Signed-off-by: Hasan Turken <turkenh@gmail.com>
71bbe96
to
8332b9d
Compare
pkg/config/resource.go
Outdated
Read *time.Duration | ||
Create *time.Duration | ||
Update *time.Duration | ||
Delete *time.Duration |
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.
Read *time.Duration | |
Create *time.Duration | |
Update *time.Duration | |
Delete *time.Duration | |
Read time.Duration | |
Create time.Duration | |
Update time.Duration | |
Delete time.Duration |
I am guessing that you had to use pointers to check whether it's given or not but there is a function (t Time) IsZero() bool
we can use to do that. If that's the only reason, we could get rid of TimeDuration(d time.Duration) *time.Duration
and work with value types.
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.
Yes, that was the reason and I was thinking that setting timeout to 0 could be a valid scenario, e.g. no timeout. But digging the terraform sdk code, I noticed that there is no such an implementation and probably no timeout does not make sense at all.
So, I would revert pointers but to check zero value I can not use IsZero()
because it is on time.Time
not time.Duration
. Am I missing something?
Otherwise, I will go with the following:
if t := fp.Config.OperationTimeouts.Read.String(); t != "0s" {
timeouts["read"] = t
}
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.
Oh yes, I missed that IsZero
wouldn't work. I think you can check like fp.Config.OperationTimeouts.Read != 0
since type Duration int64
Signed-off-by: Hasan Turken <turkenh@gmail.com>
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.
LGTM after it's tested manually. Thanks!
Description of your changes
Fixes #176
I have:
make reviewable
to ensure this PR is ready for review.How has this code been tested