Skip to content

fix(files): invalidate cached storage availability after updates#59914

Draft
joshtrichards wants to merge 5 commits intomasterfrom
jtr/fix-Storage-availability-staleness
Draft

fix(files): invalidate cached storage availability after updates#59914
joshtrichards wants to merge 5 commits intomasterfrom
jtr/fix-Storage-availability-staleness

Conversation

@joshtrichards
Copy link
Copy Markdown
Member

Summary

Fix stale storage availability reads by invalidating StorageGlobal after Storage::setAvailability() updates the database.

Problem

OC\Files\Cache\Storage::setAvailability() persists availability changes to the storages table, but StorageGlobal can continue returning a cached storage record within the same process. This can leave available and last_checked stale after a successful update.

Changes

  • clear cached storage info after availability updates
  • add targeted cache invalidation helpers to StorageGlobal
  • clear both internal caches in StorageGlobal::clearCache()
  • add a DB-backed regression test covering both string-id and numeric-id lookups
  • refresh the class docblocks for Storage and StorageGlobal

Why

This keeps in-process storage metadata reads consistent with the persisted database state and avoids stale availability reads after state transitions.

Testing

Added a regression test that primes the global storage cache, updates availability, and verifies that both string-id and numeric-id lookups observe the updated state.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI [used to generate the baseline tests]

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant