Skip to content

fix: Add random delay in Listener.cacheReloader#4639

Closed
mkleczek wants to merge 1 commit intoPostgREST:mainfrom
mkleczek:add-stutter-to-listener-notifications-handling
Closed

fix: Add random delay in Listener.cacheReloader#4639
mkleczek wants to merge 1 commit intoPostgREST:mainfrom
mkleczek:add-stutter-to-listener-notifications-handling

Conversation

@mkleczek
Copy link
Copy Markdown
Collaborator

Triggering schema cache reload immediately upon receival of notification by the listener leads to thundering herd problem in PostgREST cluster.

This change adds random delay between 0 and 1 seconds between notification retrieval and schema cache reload triggering.

@mkleczek mkleczek force-pushed the add-stutter-to-listener-notifications-handling branch 2 times, most recently from a4fb4f7 to 5f0d4be Compare February 10, 2026 16:28
@steve-chavez
Copy link
Copy Markdown
Member

Note: This is a potential solution to #4642.

@steve-chavez
Copy link
Copy Markdown
Member

This change adds random delay between 0 and 1 seconds between notification retrieval and schema cache reload triggering.

I'm wondering if 1 second is enough considering extreme cases like #4642.

@mkleczek
Copy link
Copy Markdown
Collaborator Author

This change adds random delay between 0 and 1 seconds between notification retrieval and schema cache reload triggering.

I'm wondering if 1 second is enough considering extreme cases like #4642.

Yeah, I share your concern. But didn't want to add a new config property.

After some more thought: maybe using advisory locks would be a better solution here?

@mkleczek
Copy link
Copy Markdown
Collaborator Author

After some more thought: maybe using advisory locks would be a better solution here?

@steve-chavez - see alternative solution: #4643

@mkleczek mkleczek marked this pull request as draft February 10, 2026 22:13
@mkleczek mkleczek force-pushed the add-stutter-to-listener-notifications-handling branch 2 times, most recently from 8a16e68 to 59d8f14 Compare February 11, 2026 08:12
Triggering schema cache reload immediately upon receival of notification by the listener leads to thundering herd problem in PostgREST cluster.

This change adds random delay between 0 and 1 seconds between notification retrieval and schema cache reload triggering.
@mkleczek mkleczek force-pushed the add-stutter-to-listener-notifications-handling branch from 59d8f14 to a3bc057 Compare February 11, 2026 08:43
@mkleczek
Copy link
Copy Markdown
Collaborator Author

Superseded by #4643

@mkleczek mkleczek closed this Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants