Skip to content

Conversation

@ulemons
Copy link
Contributor

@ulemons ulemons commented Nov 27, 2025

Background Cache Refresh Implementation

Overview

This PR introduces background cache refresh functionality for the queryMembersAdvanced flow. The goal is to improve performance by updating cached results asynchronously while still serving stale data immediately to users.

Changes

1. Background Cache Refresh Functions

  • Added refreshCacheInBackground() to refresh full query results.
  • Added refreshCountCacheInBackground() to refresh count-only queries.
  • Both functions execute asynchronously and do not block the main request/response cycle.

2. Database Connection Management

  • Introduced separate database connections for background operations using getDbConnection(READ_DB_CONFIG()).
  • Created new QueryExecutor instances for background tasks via pgpQx().
  • Reused the existing connection pool — no manual cleanup required.

Result

These changes reduce latency for users while ensuring cached data stays fresh behind the scenes.

@ulemons ulemons self-assigned this Nov 27, 2025
@ulemons ulemons added the Bug Created by Linear-GitHub Sync label Nov 27, 2025
@ulemons ulemons requested a review from themarolt November 27, 2025 11:21
@ulemons ulemons marked this pull request as ready for review November 27, 2025 11:22
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

1 similar comment
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@ulemons ulemons changed the title fix: adding a separate context for background requests fix: adding a separate context for background requests (CM-798) Nov 27, 2025
@ulemons ulemons force-pushed the fix/handling-context-for-background-requests branch from 997f8c5 to 35070ae Compare November 27, 2025 14:00
@ulemons ulemons merged commit 6fc4433 into main Nov 28, 2025
14 checks passed
@ulemons ulemons deleted the fix/handling-context-for-background-requests branch November 28, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants