RocketChat / RocketChat/Rocket.Chat
Cache settings fetched in started() of OmnichannelTranscript to avoid repeated fetches
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Problem
Multiple runtime settings are fetched via Promise.all inside started() of OmnichannelTranscript , with a // TODO: cache these with mem comment.
This causes repeated network/database calls on each startup or reload.
Impact
- Increased latency at startup
- Unnecessary load on settings service
- Potential rate-limit or performance regressions under heavy restarts
Suggested Fix
Implement a simple cache for these settings (use the existing mem/cache service if available, or an in-memory cache with TTL):
- On
started(), read from cache first. - On cache miss, fetch with
Promise.all, then store results in cache with a reasonable TTL . - Provide a cache key namespace scoped to
OmnichannelTranscript. - Add fallback: if cache read/write fails, continue to fetch (no breaking change).
Tests
- Unit test verifying settings are read from cache when present
- Integration/manual test showing reduced calls to settings service across repeated starts
- No behavioral change if cache is empty or fails
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at OmnichannelTranscript's started() method and inspect the existing mem/cache service, along with the Promise.all settings fetch described in the issue. Add tests covering cache hits, empty or failed caches, and repeated starts, then verify that settings-service calls are reduced without changing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100