-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
misc push-related fixes and improvements #2649
Conversation
group-income
|
Project |
group-income
|
Branch Review |
2647-fix-push
|
Run status |
|
Run duration | 11m 28s |
Commit |
|
Committer | Greg Slepak |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
10
|
|
0
|
|
114
|
View all changes introduced in this branch ↗︎ |
I've added comments where appropriate, mostly explaining why certain things are the way they were. I'm not too happy (meaning feeling neutral to negative) with the changes made to the frontend management logic (other than the extra logging and the bugfix for However, I don't think these changes will help much with the issue at hand, namely notifications stopping working after an update. This is why:
(*) There's one exception to this, but it still requires an error on the server. That is, if the logic for storing subscriptions on the DB is faulty, and some or all subscriptions are lost. |
@corrideat I've addressed all remaining feedback, please check latest changes! Note: I wasn't able to join groups when creating a link in FF and then joining in Safari. Also in both Safari and Brave I noticed this upon creating a group: However upon dismissing I saw that I was joined. I don't think these issues have anything to do with this PR but might be related to some of that commented out code (#2653) or other issues. Opened an issue for this: #2654 |
backend/push.js
Outdated
await deleteSubscriptionFromIndex(subscriptionId) | ||
await sbp('chelonia.db/delete', `_private_webpush_${subscriptionId}`) |
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 realise this was like this from before, but I'm wondering if maybe the order of these two operations should be reversed
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 know, if there's a strong reason for it that can be given I'm certainly happy to do it.
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.
The reason is that if the deletion fails, then it'll still be in the index.
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.
How will reversing the order fix that? It first deletes from the index right now. If there's a problem with writing to the DB, it's the index deletion that will fail first, and then it won't get to deleting the subscriptionID.
Whereas, if it successfully deletes the subscription key, but then fails to delete it from the index, it will be in the index but won't exist.
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.
It doesn't 'fix' it, but it being in the index but not existing is worse than the converse, based on the assumption that keys may not be enumerable.
@@ -219,6 +174,7 @@ export const postEvent = async (subscription: Object, event: ?string): Promise<v | |||
// Note: web push notifications can be 'bodyless' or they can contain a body | |||
// If there's no body, there isn't anything to encrypt, so we skip both the | |||
// encryption and the encryption headers. | |||
// console.debug(`postEvent to ${subscription.id}:`, event) |
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.
Stray debug?
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 it's OK to leave here just in case someone is debugging this part of the code. I found it useful and that's why I decided to comment it out instead of removing it completely. If you really want me to remove it I can though.
'service-worker/setup-push-subscription': async function (retryCount?: number) { | ||
if (process.env.CI) { | ||
'service-worker/setup-push-subscription': async function (attemptNumber = 1) { | ||
if (window.Cypress || process.env.CI) { |
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.
Not a strong feeling either way, but the reason I was not checking for window.Cypress
(and generally avoid doing so) is that these are runtime checks (code shipped) while process.env.CI
is exclusively a buildtime check (no code shipped).
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.
Had to add it because without it the tests weren't passing. An alternative would be to create a Cypress envvar in Gruntfile.js
...
c944afa
to
6c417b0
Compare
d3b3fd0
to
4694034
Compare
I've been reviewing this and testing it, and it seems like most things work. I didn't yet test this as comprehensively as the previous code (esp. re. the frontend parts), but it looks like it should work. Can you as a last change request:
|
Related to issues #2647 and #2653