Skip to content

Bugfix/cache settings getclientcheck - #3275

Closed
danoswaltCL wants to merge 2 commits into
release/6.6from
bugfix/cache-settings-getclientcheck
Closed

Bugfix/cache settings getclientcheck#3275
danoswaltCL wants to merge 2 commits into
release/6.6from
bugfix/cache-settings-getclientcheck

Conversation

@danoswaltCL

Copy link
Copy Markdown
Collaborator

the ClientCheck middleware is called on every client call. it eats up a little time in every call. this data hardly ever changes, and really ought to be in the env vars honestly, but anyway, not fetching this gives us a handful of milliseconds and frees up a db connection on every single client call.

@danoswaltCL
danoswaltCL requested review from bcb37 and a lite review from Copilot August 7, 2026 20:59
@danoswaltCL danoswaltCL closed this Aug 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces caching for the global “client check” settings to avoid a database read on every clientlib request, reducing per-request latency and freeing a DB connection from the hot path.

Changes:

  • Added a dedicated cache key prefix for settings and introduced per-category TTL support for settings (CACHING_TTL_SETTINGS).
  • Updated SettingService.getClientCheck() to use CacheService.wrap() and invalidated that cache key in setClientCheck().
  • Expanded/adjusted unit tests to provide a CacheService and to assert getClientCheck caching + invalidation behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/types/src/Experiment/enums.ts Adds a cache prefix for settings keys.
packages/backend/src/env.ts Adds CACHING_TTL_SETTINGS to backend env configuration.
packages/backend/src/api/services/CacheService.ts Adds a settings cache bucket and TTL wiring for the new prefix.
packages/backend/src/api/services/SettingService.ts Wraps getClientCheck in cache and invalidates on setClientCheck.
packages/backend/test/unit/services/SettingService.test.ts Adds cache-aware tests validating caching + invalidation behavior.
packages/backend/test/unit/services/MetricService.test.ts Provides a pass-through CacheService stub to keep existing tests behavior stable.
packages/backend/.env.example Documents the new CACHING_TTL_SETTINGS env var.
packages/backend/src/api/services/ImportExportService.ts Changes TypeORM relation loading strategy for experiment export (scope mismatch with PR description).

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

logger.info({ message: `Inside export Experiment JSON ${experimentIds}` });
const experimentDetails = await this.experimentRepository.find({
where: experimentIds ? { id: In(experimentIds) } : undefined,
relationLoadStrategy: 'query',
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.

3 participants