Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix schema emptying issue from watch mode #1834

Merged
merged 3 commits into from
Oct 30, 2023
Merged

Conversation

benjie
Copy link
Member

@benjie benjie commented Oct 30, 2023

Description

Fixes #1761

There was two bugs in the introspection plugin:

  1. the cache was being invalidated too early, which meant that multiple database events in quick succession would incorrectly reuse previous caches
  2. the cache also cached the "announcements" of introspection, meaning when the cache is used the schema building wouldn't even see the database changes!

I've refactored the code to separate the side effects from the introspection so that they can be cached separately (side effects to state, introspection to permanent cache) and I've now tracked whether the introspection results are "dirty" or not - if another event arrives before introspection of the DB occurs then we'll mark the introspection as dirty to ensure that it isn't reused.

Performance impact

None known.

Security impact

None known.

Checklist

  • My code matches the project's code style and yarn lint:fix passes.
  • I've added tests for the new feature, and yarn test passes.
  • I have detailed the new feature in the relevant documentation.
  • I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • If this is a breaking change I've explained why.

@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2023

🦋 Changeset detected

Latest commit: cbf3820

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
graphile-build-pg Patch
postgraphile Patch
graphile-utils Patch
pgl Patch
graphile Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@benjie benjie merged commit 59320e1 into main Oct 30, 2023
24 checks passed
@benjie benjie deleted the fix-watch-mode-failures branch October 30, 2023 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

V5 - bug(postgraphile watcher): Creating/deleting table nulls out schema
1 participant