-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
LiveQueryEvent Error Logging Improvements #6951
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
Changes from all commits
18dc84b
a76b7f0
968de7d
2510b66
fae8223
fe2812d
c2368cd
9b0face
d51a3f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,19 +182,33 @@ class ParseLiveQueryServer { | |
clients: this.clients.size, | ||
subscriptions: this.subscriptions.size, | ||
useMasterKey: client.hasMasterKey, | ||
installationId: client.installationId | ||
installationId: client.installationId, | ||
sendEvent: true, | ||
}; | ||
return maybeRunAfterEventTrigger('afterEvent', className, res); | ||
}) | ||
.then(() => { | ||
if (!res.sendEvent) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be removed no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is in relation to preventing events from firing, which was previously achieved by throwing in the trigger. Setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry @dplewis, I'm not sure what the issue is, what would you like me to change? 😊 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Throwing an error handles events from firing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, no worries. I added For example, only passing LQ update on "foo" change:
Would log on every single LQ event for TestObject, and pass a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see |
||
return; | ||
} | ||
if (res.object && typeof res.object.toJSON === 'function') { | ||
deletedParseObject = res.object.toJSON(); | ||
deletedParseObject.className = className; | ||
} | ||
client.pushDelete(requestId, deletedParseObject); | ||
}) | ||
.catch(error => { | ||
logger.error('Matching ACL error : ', error); | ||
Client.pushError( | ||
client.parseWebSocket, | ||
error.code || 141, | ||
error.message || error, | ||
false, | ||
requestId | ||
); | ||
logger.error( | ||
`Failed running afterLiveQueryEvent on class ${className} for event ${res.event} with session ${res.sessionToken} with:\n Error: ` + | ||
JSON.stringify(error) | ||
); | ||
}); | ||
} | ||
} | ||
|
@@ -297,7 +311,6 @@ class ParseLiveQueryServer { | |
isCurrentMatched, | ||
subscription.hash | ||
); | ||
|
||
// Decide event type | ||
let type; | ||
if (isOriginalMatched && isCurrentMatched) { | ||
|
@@ -322,12 +335,16 @@ class ParseLiveQueryServer { | |
clients: this.clients.size, | ||
subscriptions: this.subscriptions.size, | ||
useMasterKey: client.hasMasterKey, | ||
installationId: client.installationId | ||
installationId: client.installationId, | ||
sendEvent: true, | ||
}; | ||
return maybeRunAfterEventTrigger('afterEvent', className, res); | ||
}) | ||
.then( | ||
() => { | ||
if (!res.sendEvent) { | ||
return; | ||
} | ||
if (res.object && typeof res.object.toJSON === 'function') { | ||
currentParseObject = res.object.toJSON(); | ||
currentParseObject.className = | ||
|
@@ -349,7 +366,17 @@ class ParseLiveQueryServer { | |
} | ||
}, | ||
error => { | ||
logger.error('Matching ACL error : ', error); | ||
Client.pushError( | ||
client.parseWebSocket, | ||
error.code || 141, | ||
error.message || error, | ||
false, | ||
requestId | ||
); | ||
logger.error( | ||
`Failed running afterLiveQueryEvent on class ${className} for event ${res.event} with session ${res.sessionToken} with:\n Error: ` + | ||
JSON.stringify(error) | ||
); | ||
} | ||
); | ||
} | ||
|
@@ -658,7 +685,7 @@ class ParseLiveQueryServer { | |
} catch (error) { | ||
Client.pushError( | ||
parseWebsocket, | ||
error.code || 101, | ||
error.code || 141, | ||
error.message || error, | ||
false | ||
); | ||
|
@@ -776,7 +803,7 @@ class ParseLiveQueryServer { | |
} catch (e) { | ||
Client.pushError( | ||
parseWebsocket, | ||
e.code || 101, | ||
e.code || 141, | ||
e.message || e, | ||
false, | ||
request.requestId | ||
|
Uh oh!
There was an error while loading. Please reload this page.