-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Correcting the condition for updating a silence. Earlier was checking… #2816
Conversation
Fixes #2809 |
silence/silence.go
Outdated
@@ -586,7 +586,7 @@ func canUpdate(a, b *pb.Silence, now time.Time) bool { | |||
// Allowed timestamp modifications depend on the current time. | |||
switch st := getState(a, now); st { | |||
case types.SilenceStateActive: | |||
if !b.StartsAt.Equal(a.StartsAt) { | |||
if b.StartsAt.Unix()-a.StartsAt.Unix() != 0 { |
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.
if b.StartsAt.Unix()-a.StartsAt.Unix() != 0 { | |
if b.StartsAt.Unix() != a.StartsAt.Unix() { |
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.
Done
Thanks, I have added a comment that makes this simpler. Is there an easy test we could add for this, or a comment we should write about why we call that method? |
33d33a9
to
9726794
Compare
There is a test case that I have added. Is there something else that you are looking for? |
silence/silence_test.go
Outdated
} | ||
id1, _ := s.Set(sil1) | ||
|
||
// Update silence |
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.
// Update silence | |
// Update silence with 2 extra nanoseconds, so the "seconds" part should not change. |
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.
Done
… upto nanosecond precision but reduced to second as the UI only sends upto millisecond Signed-off-by: Prashant Balachandran <pnair@redhat.com>
9726794
to
6618217
Compare
Correcting the condition for updating a silence. Earlier was checking upto
nanosecond precision but reduced to second as the UI only sends upto millisecond
Signed-off-by: Prashant Balachandran pnair@redhat.com