-
Notifications
You must be signed in to change notification settings - Fork 88
fix: resolve direction calculator caching bugs and prevent stale queries on hot-swap #797
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
Changes from all commits
493a624
e8073b3
194fb5c
1905c5e
e074312
69f17c7
09693cc
99103ee
9800344
f03ce93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there an easy way you can add a test for the new behavior you've added, verifying that a returned error value isn't cached?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! I've added TestTransientDBError_NotCached. It simulates a db failure by closing an in-memory database and verifies that the resulting empty string is not cached |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, even if computeFromShapes returned an err, you're returning
computedDirand anilerror. If the intention is to ignore errors, you should leave a comment here explaining why it's safe to do so.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intentional so we gracefully fallback to an empty direction "" without failing the API. Returning nil also ensures singleflight correctly shares this fallback with concurrent callers. I've added a comment to clarify this. Thanks!