Skip to content

uid2: hold targeting calls while a token refresh is in flight - #343

Open
etiennelatendresse-optable wants to merge 3 commits into
masterfrom
uid2-refresh-targeting-lock
Open

etiennelatendresse-optable wants to merge 3 commits into
masterfrom
uid2-refresh-targeting-lock

Conversation

@etiennelatendresse-optable

@etiennelatendresse-optable etiennelatendresse-optable commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Why

A uid2 refresh and a targeting call happening at the same time run the risk of a race condition where a targeting call could happen mid refresh causing a fresh EID, possibly by another matcher, to pair with a stale refresh outcome.

What Changed

  • uid2-refresh-lock refreshes register on a counter (trackUid2Refresh) and uid2RefreshIdle resolves when none are in flight.
  • Targeting() awaits uid2RefreshIdle(2000) before firing. This is a upperbound since the refresh fetch has no timeout. A refresh finishing before the timeout will cause the targeting to happen right away.
  • Add unit tests

How to Test

  • Tested
  • Docs updated

Notes

Co-authored-by: Etienne Latendresse etienne.latendresse@optable.co

Base automatically changed from migrate-eid-cache-merge to master September 16, 2026 19:18
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.

1 participant