Skip to content

notify: use tick time in dedup repeat checks#4864

Open
KyungHwanKim-devs wants to merge 1 commit intoprometheus:mainfrom
KyungHwanKim-devs:fix/2461-testretry-darwin
Open

notify: use tick time in dedup repeat checks#4864
KyungHwanKim-devs wants to merge 1 commit intoprometheus:mainfrom
KyungHwanKim-devs:fix/2461-testretry-darwin

Conversation

@KyungHwanKim-devs
Copy link
Contributor

Summary

  • Use dispatcher tick time (context Now) for dedup repeat-interval checks.
  • Add a regression test ensuring dedup honors the context time source.
  • Update changelog.

Background

Issue #2461 reports TestRetry consistently failing on Darwin due to repeat notifications occurring earlier than expected.

Root Cause

DedupStage relied on time.Now() instead of the dispatcher-provided tick time. When the pipeline execution is delayed on Darwin, the repeat interval appears to have already elapsed, causing an early resend.

Fix

DedupStage now prefers the context Now value (set by dispatch) and falls back to its internal clock when absent, making repeat-interval decisions deterministic.

Testing

  • make test (macOS: ld LC_DYSYMTAB warnings)

Fixes #2461.

Copy link
Contributor

@ultrotter ultrotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully love it as it's quite manual and easy to forget the overridden time.
But perhaps it's fine so far, and anyway we can evaluate moving to synctest avoiding manual time mocks, after the next go version is released.

@Spaceman1701
Copy link
Contributor

I don't fully love it as it's quite manual and easy to forget the overridden time. But perhaps it's fine so far, and anyway we can evaluate moving to synctest avoiding manual time mocks, after the next go version is released.

I agree that this is a little ugly, but I think it's the intended way to get the time in a notification pipeline. I wonder if it'd be a little cleaner to make DedupStage.now take a ctx and encapsulate the behavior of finding the time from the context.

@SoloJacobs SoloJacobs requested review from Spaceman1701 and siavashs and removed request for siavashs February 20, 2026 16:00
Copy link
Contributor

@Spaceman1701 Spaceman1701 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to approve before, but I think this is good to merge as is.

@KyungHwanKim-devs looks like this requires a rebase. I can merge after you've done that. Thanks for the contribution!

Signed-off-by: kkh <kkhdevs@gmail.com>
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
Co-authored-by: Solomon Jacobs <solomonjacobs@protonmail.com>
@SoloJacobs SoloJacobs force-pushed the fix/2461-testretry-darwin branch from 81133ab to f241e15 Compare February 26, 2026 08:24
@SoloJacobs
Copy link
Contributor

I have rebased this commit. I think it is good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestRetry fails on Darwin

4 participants