feat(indexworker): add max users threshold for rollout#2374
Conversation
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughSummary by CodeRabbit
WalkthroughAdded a numeric gating mechanism for creating user-search indexes. A new configuration field Sequence Diagram(s)sequenceDiagram
participant API as APIWorker
participant IW as IndexWorker
participant DB as Database
participant Log as Logger
API->>IW: maybeCreateIndexes(ctx)
IW->>IW: check cfg.IndexWorker.EnsureUserSearchIndexesExist\nand cfg.IndexWorker.MaxUsersThreshold
alt EnsureUserSearchIndexesExist == true
IW->>Log: log "index_creation_starting" (opt-in)
IW->>DB: acquire advisory lock / create indexes
DB-->>IW: index creation result
IW->>Log: log result or error
else MaxUsersThreshold > 0 and EnsureUserSearchIndexesExist == false
IW->>DB: query approximate users count
DB-->>IW: returns userCount
alt userCount > MaxUsersThreshold
IW->>Log: log "index_creation_skipped" with userCount and threshold
else
IW->>Log: log "index_creation_starting" with userCount
IW->>DB: acquire advisory lock / create indexes
DB-->>IW: index creation result
IW->>Log: log result or error
end
else
IW->>Log: log "index_creation_starting"
IW->>DB: acquire advisory lock / create indexes
DB-->>IW: index creation result
IW->>Log: log result or error
end
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
cstockton
left a comment
There was a problem hiding this comment.
Is it possible to remove the default of 0 to mean any, and instead make "any" be something like math.MaxInt64? My main concern being if something sets enabled to true expecting an accompanying threshold to be set, but it doesn't and the default of 0 means any.
Approving ahead of time to keep you unblocked.
93c7263 to
00cb768
Compare
|
Thanks @cstockton — I agree, I've decided to simplify the config and make the 2 configuration variables independent of one another:
|
Pull Request Test Coverage Report for Build 22075075135Details
💛 - Coveralls |
🤖 I have created a release *beep* *boop* --- ## [2.187.0](v2.186.0...v2.187.0) (2026-02-23) ### Features * add metadata field to all hooks ([#2365](#2365)) ([c675749](c675749)) * check current password on change ([#2364](#2364)) ([33b87ae](33b87ae)) * **indexworker:** add max users threshold for rollout ([#2374](#2374)) ([a2066c6](a2066c6)) * **metrics:** added a gauge with version information ([#2375](#2375)) ([911ad0b](911ad0b)) * support custom oauth & oidc providers ([#2357](#2357)) ([53021f6](53021f6)) ### Bug Fixes * case-insensitive Bearer token scheme matching ([#2387](#2387)) ([36d712d](36d712d)) * correctly parse JWT ValidMethods from env by enabling split_words ([#2334](#2334)) ([a6076bc](a6076bc)) * flaky index worker test ([#2366](#2366)) ([961a7e6](961a7e6)) * **hooks:** propagate error objects from hook calls ([#2380](#2380)) ([3ca1e88](3ca1e88)) * session upgrade percentage should be based on session, not request ([#2371](#2371)) ([510e68b](510e68b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
Adds max users threshold config value to allow for a managed rollout.