feat: cache warm audit - #896
Open
Derekwalter999 wants to merge 1 commit into
Open
Conversation
Implements cache-warm for /api/audit on startup to avoid cold-cache spikes. Fixes buffer2 Predictify-org#2.
|
@Derekwalter999 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses backend issue #385 for the GrantFox FWC26 campaign (buffer2 #2). It implements an automated cache warm-up sequence for the
/api/auditendpoint during application startup, which effectively mitigates cold-cache latency spikes for initial requests.Changes Made
src/services/auditCacheWarm.ts: Added thewarmAuditCache()service function. It utilizes the native NodefetchAPI to make an internal background request to/api/audit?limit=10with a timeout mechanism.src/index.ts: Wired the cache warm-up logic into the server lifecycle, executing it immediately after the Express app binds and begins listening.src/__tests__/services/auditCacheWarm.test.ts: Added a comprehensive test suite to validate success paths, non-200 responses, and network-level fetch errors.Compliance & Acceptance Criteria
/api/auditendpoint is now actively warmed up on startup.uuidv4()) and adheres to the standardized Pino logging structure for tracking warm-up lifecycles.Closes #385