Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Add snippet for reloading on read replicas #638

Open
steve-chavez opened this issue Jun 7, 2023 · 0 comments
Open

Add snippet for reloading on read replicas #638

steve-chavez opened this issue Jun 7, 2023 · 0 comments
Labels
references Technical reference.

Comments

@steve-chavez
Copy link
Member

Related to PostgREST/postgrest#2781.

I thought of adding the following to http://postgrest.org/en/stable/references/schema_cache.html#automatic-schema-cache-reloading

  IF pg_is_in_recovery()
  THEN
    PERFORM pg_terminate_backend(pid) FROM pg_stat_activity 
    WHERE application_name ilike '%postgrest%';
  ELSE
	  NOTIFY pgrst, 'reload schema';
  END IF;

But terminating the connection is not graceful for a cache reload as requests will fail once.

There might be a way forward with PostgREST/postgrest#1766 (comment), so I'll hold this snippet until that's settled.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
references Technical reference.
Development

No branches or pull requests

1 participant