Skip to content

fix: no tenant cache for run migrations event#957

Merged
ferhatelmas merged 1 commit intomasterfrom
ferhat/run-migrations
Apr 1, 2026
Merged

fix: no tenant cache for run migrations event#957
ferhatelmas merged 1 commit intomasterfrom
ferhat/run-migrations

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Run migrations event uses a cached config.

What is the new behavior?

Event uses a fresh copy by loading from db.

Additional context

Cached value could be with stale config.

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@ferhatelmas ferhatelmas requested a review from a team as a code owner April 1, 2026 07:36
Copilot AI review requested due to automatic review settings April 1, 2026 07:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures the “run migrations” queue event does not rely on potentially stale in-memory tenant configuration by explicitly clearing the tenant config cache before loading the tenant config from the multitenant DB.

Changes:

  • Clear the in-memory tenant config cache at the start of RunMigrationsOnTenants.handle() before calling getTenantConfig().
  • Extend the corresponding test to assert the cache invalidation call happens before the config is fetched.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/storage/events/migrations/run-migrations.ts Clears tenant config cache prior to fetching config for migrations execution.
src/test/run-migrations-event.test.ts Adds assertions verifying deleteTenantConfig() is called and precedes getTenantConfig().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 1, 2026

Pull Request Test Coverage Report for Build 23838572089

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 80.447%

Files with Coverage Reduction New Missed Lines %
src/storage/protocols/tus/s3-locker.ts 4 88.57%
Totals Coverage Status
Change from base Build 23806324372: 0.02%
Covered Lines: 29800
Relevant Lines: 36865

💛 - Coveralls

@ferhatelmas
Copy link
Copy Markdown
Member Author

ferhatelmas commented Apr 1, 2026

This was just hardening becauase cache is always supposed to be up to date. If not, we have bigger issues.

See it as documentation, closing.

We decided to take it since it's a small nice to have.

@ferhatelmas ferhatelmas closed this Apr 1, 2026
@ferhatelmas ferhatelmas deleted the ferhat/run-migrations branch April 1, 2026 07:55
@ferhatelmas ferhatelmas restored the ferhat/run-migrations branch April 1, 2026 08:06
@ferhatelmas ferhatelmas reopened this Apr 1, 2026
@ferhatelmas ferhatelmas merged commit 18d9386 into master Apr 1, 2026
14 of 15 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/run-migrations branch April 1, 2026 08:16
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.

4 participants