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

Discard earliest heartbeat once there are 30 heartbeats #8724

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

dlarocque
Copy link
Contributor

Currently, we discard heartbeats once they are 30 days old. This PR changes this behaviour to only discard the earliest heartbeat once a limit of 30 heartbeats in IndexedDB has been reached.

@dlarocque dlarocque requested review from a team as code owners January 23, 2025 20:13
Copy link

changeset-bot bot commented Jan 23, 2025

🦋 Changeset detected

Latest commit: 1df9887

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/app Patch
@firebase/app-compat Patch
firebase Patch

Not sure what this means? Click here to learn what changesets are.

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

packages/app/src/heartbeatService.test.ts Outdated Show resolved Hide resolved
packages/app/src/heartbeatService.ts Outdated Show resolved Hide resolved
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 23, 2025

Size Report 1

Affected Products

  • @firebase/app

    TypeBase (24a90ee)Merge (4a0b42a)Diff
    browser19.2 kB19.5 kB+277 B (+1.4%)
    main20.1 kB20.4 kB+277 B (+1.4%)
    module19.2 kB19.5 kB+277 B (+1.4%)
  • @firebase/database-compat/standalone

    TypeBase (24a90ee)Merge (4a0b42a)Diff
    main365 kB366 kB+277 B (+0.1%)
  • bundle

    46 size changes

    TypeBase (24a90ee)Merge (4a0b42a)Diff
    analytics (logEvent)44.6 kB44.7 kB+110 B (+0.2%)
    app-check (CustomProvider)37.3 kB37.4 kB+110 B (+0.3%)
    app-check (ReCaptchaEnterpriseProvider)39.8 kB39.9 kB+110 B (+0.3%)
    app-check (ReCaptchaV3Provider)39.8 kB39.9 kB+110 B (+0.3%)
    auth (Anonymous)76.4 kB76.5 kB+110 B (+0.1%)
    auth (EmailAndPassword)86.5 kB86.6 kB+110 B (+0.1%)
    auth (GoogleFBTwitterGitHubPopup)103 kB103 kB+110 B (+0.1%)
    auth (GooglePopup)100 kB101 kB+110 B (+0.1%)
    auth (GoogleRedirect)101 kB101 kB+110 B (+0.1%)
    auth (Phone)93.9 kB94.0 kB+110 B (+0.1%)
    database (Append to a list of data)149 kB150 kB+110 B (+0.1%)
    database (Filtering data)148 kB148 kB+110 B (+0.1%)
    database (Listen for child events)165 kB165 kB+110 B (+0.1%)
    database (Listen for value events + Detach listeners)165 kB165 kB+110 B (+0.1%)
    database (Listen for value events)165 kB165 kB+110 B (+0.1%)
    database (Read data once)164 kB164 kB+110 B (+0.1%)
    database (Save data as transactions)167 kB167 kB+110 B (+0.1%)
    database (Sort data)150 kB150 kB+110 B (+0.1%)
    database (Write data)149 kB149 kB+110 B (+0.1%)
    firestore (CSI Auto Indexing Disable and Delete)271 kB271 kB+110 B (+0.0%)
    firestore (CSI Auto Indexing Enable)271 kB271 kB+110 B (+0.0%)
    firestore (Persistence)302 kB302 kB+110 B (+0.0%)
    firestore (Query Cursors)249 kB249 kB+110 B (+0.0%)
    firestore (Query)247 kB247 kB+110 B (+0.0%)
    firestore (Read data once)235 kB235 kB+110 B (+0.0%)
    firestore (Read Write w Persistence)327 kB327 kB+110 B (+0.0%)
    firestore (Realtime updates)237 kB237 kB+110 B (+0.0%)
    firestore (Transaction)214 kB214 kB+110 B (+0.1%)
    firestore (Write data)214 kB214 kB+110 B (+0.1%)
    firestore-lite (Query Cursors)103 kB103 kB+110 B (+0.1%)
    firestore-lite (Query)99.1 kB99.2 kB+110 B (+0.1%)
    firestore-lite (Read data once)74.5 kB74.6 kB+110 B (+0.1%)
    firestore-lite (Transaction)99.8 kB99.9 kB+110 B (+0.1%)
    firestore-lite (Write data)84.1 kB84.2 kB+110 B (+0.1%)
    functions (call)34.7 kB34.8 kB+110 B (+0.3%)
    messaging (send + receive)47.4 kB47.5 kB+110 B (+0.2%)
    performance (trace)62.3 kB62.4 kB+110 B (+0.2%)
    remote-config (getAndFetch)47.5 kB47.7 kB+110 B (+0.2%)
    storage (getBytes)42.3 kB42.4 kB+110 B (+0.3%)
    storage (getDownloadURL)44.4 kB44.5 kB+110 B (+0.2%)
    storage (getMetadata)43.8 kB43.9 kB+110 B (+0.3%)
    storage (list + listAll)43.2 kB43.3 kB+110 B (+0.3%)
    storage (updateMetadata)44.1 kB44.2 kB+110 B (+0.2%)
    storage (uploadBytes)48.9 kB49.0 kB+110 B (+0.2%)
    storage (uploadBytesResumable)58.9 kB59.0 kB+110 B (+0.2%)
    storage (uploadString)49.1 kB49.3 kB+110 B (+0.2%)

  • firebase

    TypeBase (24a90ee)Merge (4a0b42a)Diff
    firebase-app-compat.js32.3 kB32.5 kB+114 B (+0.4%)
    firebase-app.js102 kB103 kB+707 B (+0.7%)
    firebase-compat.js808 kB808 kB+114 B (+0.0%)
    firebase-performance-standalone-compat.js105 kB105 kB+115 B (+0.1%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/0hRb5lD7pE.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 23, 2025

Size Analysis Report 1

This report is too large (212,236 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/UfW3ZUpn0V.html

expect(
heartbeatService._heartbeatsCache?.heartbeats.indexOf(earliestHeartbeat)
).to.equal(-1);
});
it('triggerHeartbeat() never exceeds 30 heartbeats', async () => {
it('triggerHeartbeat() never exceeds MAX_NUM_STORED_HEARTBEATS heartbeats', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, the second heartbeats in this string seems redundant.

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