Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: memoize app getStatus calls #35426

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft

Conversation

Gustrb
Copy link
Contributor

@Gustrb Gustrb commented Mar 7, 2025

Proposed changes (including videos or screenshots)

Due to the previous architecture of the apps-engine, several flows are dependent on calling the getStatus method exposed by the app.

However, after Deno runtime, these add a lot more overhead compared to simple in memory access, clog the output queue of the subprocess and are prone to errors that simply didn’t happen before (30s timeouts, subprocess unavailable, etc.)

These calls should be better handled to reduce the strain on the system.

Issue(s)

Steps to test or reproduce

Further comments

CONN-451

Copy link
Contributor

dionisio-bot bot commented Mar 7, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Mar 7, 2025

⚠️ No Changeset found

Latest commit: b9cc661

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Mar 7, 2025

PR Preview Action v1.6.0

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-35426/

Built to branch gh-pages at 2025-03-07 17:48 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link

codecov bot commented Mar 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.46%. Comparing base (bbf12a1) to head (b9cc661).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #35426   +/-   ##
========================================
  Coverage    59.46%   59.46%           
========================================
  Files         2830     2830           
  Lines        68579    68579           
  Branches     15177    15177           
========================================
  Hits         40778    40778           
  Misses       25132    25132           
  Partials      2669     2669           
Flag Coverage Δ
unit 75.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +31 to +40
private clearExpired(): void {
const now = new Date();

for (const appId in this.cache) {
if (this.cache[appId].expiresAt < now) {
delete this.cache[appId];
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

i think this and the timer is unnecessary.

if cached item expired, you are setting a fresh one anyway and returning undefined here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, I forgot to take into account that a workspace cannot have that many apps such that this would be required

Comment on lines +5 to +8
private readonly CACHE_TTL = 1000 * 60;

// We clean up the cache every 5 minutes
private readonly CLEANUP_INTERVAL = 1000 * 60 * 5;
Copy link
Member

Choose a reason for hiding this comment

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

give them environment variables so we can configure from outside?

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.

2 participants