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: reused instances don't keep cache #731

Merged
merged 2 commits into from
Jan 15, 2025
Merged

Conversation

mshanemc
Copy link
Contributor

What does this PR do?

reused instances don't keep cache

explanation: RemoteSourceTrackingService(RSTS) is singleton-by-project.

queryCache is used by querySourceMembersFrom

For long-running processes (cliaas, vscode, etc) you'd potentially get wrong answers for a project by

  1. getChanges (gets changes from last known revision ex: >60)
  2. add/edit/delete some metadata
  3. instantiate a new SourceTracking on the same project
  4. getChanges (hits queryCache for 60 so it doesn't see the new changes)

with this PR, if a new instance of SourceTracking constructs instantiates a RSTS (getting it from the instanceMap) it clears the queryCache.

Result:
if you keep using the same instance of SourceTracking, the queryCache in RSTS works like current
if you instantiate a new SourceTracking, the queryCache starts empty even if it doesn't have to reconstruct a new RSTS

alternatives considered but rejected

  • boolean cache param on getChanges, passed down through it
  • dropping the cache entirely for querySourceMembersFrom (code comment is about the old pull command but it might apply to project retrieve 🤷

What issues does this PR fix or reference?

@W-17609556@

@mshanemc mshanemc requested a review from a team as a code owner January 15, 2025 22:18
@shetzel shetzel merged commit 1a1a48c into main Jan 15, 2025
23 checks passed
@shetzel shetzel deleted the sm/shorter-term-query-cache branch January 15, 2025 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants