-
Notifications
You must be signed in to change notification settings - Fork 927
[Heartbeat Service] More null service protections added to triggerHeartBeat #7789
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
Conversation
🦋 Changeset detectedLatest commit: e2a206a The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1This report is too large (141,122 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 |
@@ -90,6 +90,10 @@ export class HeartbeatServiceImpl implements HeartbeatService { | |||
const date = getUTCDateString(); | |||
if (this._heartbeatsCache?.heartbeats == null) { | |||
this._heartbeatsCache = await this._heartbeatsCachePromise; | |||
// If we failed to construct a heartbeats cache, then return immediately. | |||
if (this._heartbeatsCache?.heartbeats == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hsubox76 perhaps this should just check if heartbeatsCache === null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the root problem is here:
return idbHeartbeatObject || { heartbeats: [] }; |
HeartbeatsInIndexedDB
), otherwise we are lying to typescript and so it can't protect us by catching errors further downstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I updated the read()
method (below) to ensure the returned object has a heartbeats
field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this check should be needed anymore after the other change but I guess it doesn't hurt to be safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I feel like keeping it place just in case.
@@ -90,6 +90,10 @@ export class HeartbeatServiceImpl implements HeartbeatService { | |||
const date = getUTCDateString(); | |||
if (this._heartbeatsCache?.heartbeats == null) { | |||
this._heartbeatsCache = await this._heartbeatsCachePromise; | |||
// If we failed to construct a heartbeats cache, then return immediately. | |||
if (this._heartbeatsCache?.heartbeats == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this check should be needed anymore after the other change but I guess it doesn't hurt to be safe.
Changeset File Check ✅
|
Discussion
Users are reporting furhter issues with the heartbeat service returning a null cache on Opera. There's a case in
triggerHeartBeat
which the code assumes that the cache was created properly.Add a check to ensure that the cache exists, and if not, returns immediately.
Testing
CI.
API Changes
N/A.