Page MenuHomePhabricator

[services] Tunnelbroker - Updating `Send` handler with using of the Rust notification library
ClosedPublic

Authored by max on Sep 22 2022, 4:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 8:14 AM
Unknown Object (File)
Wed, Nov 20, 4:07 PM
Unknown Object (File)
Fri, Nov 8, 3:51 PM
Unknown Object (File)
Fri, Nov 8, 4:15 AM
Unknown Object (File)
Oct 26 2024, 2:33 AM
Unknown Object (File)
Oct 26 2024, 2:33 AM
Unknown Object (File)
Oct 26 2024, 2:33 AM
Unknown Object (File)
Oct 26 2024, 2:33 AM

Details

Summary

This diff introduces changes to the Send handler to use the Rust notification library to send the push notifications.
In case we have a token-related error returning from the APNs or FCM we will clear the device token in the database and request the client to provide a new one in D5206, D5207.

Related Linear task: ENG-1331

Test Plan
  • The service was successfully built.
  • To test APNs (iOS) messages delivery use the procedure described in ENG-1743
  • To test FCM (Android) messages delivery use the procedure described in ENG-1742

Diff Detail

Repository
rCOMM Comm
Branch
update-send-with-notifs
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

max held this revision as a draft.
max published this revision for review.Sep 22 2022, 5:12 AM
max edited the summary of this revision. (Show Details)
max edited the test plan for this revision. (Show Details)
max added a reviewer: tomek.
max retitled this revision from [services] Tunnelbroker - Updating `Send` handler with using of the rust notification library to [services] Tunnelbroker - Updating `Send` handler with using of the Rust notification library.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
191–194 ↗(On Diff #16979)

No point to these nested if statements, they can just be combined. The lower the indentation level, the more clear the code is (in my opinion)

max added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
191–194 ↗(On Diff #16979)

No point to these nested if statements, they can just be combined. The lower the indentation level, the more clear the code is (in my opinion)

I did it on purpose because we had the rule to split the long condition statement into a few to make it more readable. If it looks ok to merge it in case of reading the code I'll do it now ;)

services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
191–194 ↗(On Diff #16979)

Not familiar with the rule you're referencing

tomek requested changes to this revision.Sep 23 2022, 5:26 AM

Shouldn't we check if device is online?

services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
166–200 ↗(On Diff #16979)

The code would be more readable if these were extracted into a function

181 ↗(On Diff #16979)

Maybe can't clear an invalid token, or something like that?

This revision now requires changes to proceed.Sep 23 2022, 5:26 AM
max marked an inline comment as done.

Adding of checking for device is online.
Error message text was changed.

In D5210#153347, @tomek wrote:

Shouldn't we check if device is online?

Wooow, I've missed that! Thanks a lot @tomek !
Fixed.

max added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
166–200 ↗(On Diff #16979)

The code would be more readable if these were extracted into a function

Yes, I think so, I'll create a small follow-up for this.

181 ↗(On Diff #16979)

Maybe can't clear an invalid token, or something like that?

Makes sense, I've changed the text.

max marked 2 inline comments as done.

Merging nested if's.

tomek added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
164 ↗(On Diff #17027)

Early exit would decrease the indentation. Also we can check notifyToken.empty() here.

191–194 ↗(On Diff #16979)

Please merge the ifs as @ashoat suggested

This revision is now accepted and ready to land.Sep 23 2022, 8:13 AM
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
197

This message should also be updated

max added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
191–194 ↗(On Diff #16979)

Please merge the ifs as @ashoat suggested

Already done, thanks @tomek !

max marked an inline comment as done.

Error message changed, rebased on the latest changes.

max added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
197

This message should also be updated

Makes sense! Done.

max marked an inline comment as done.

Resolving merge conflict.

This revision was landed with ongoing or failed builds.Sep 23 2022, 12:46 PM
This revision was automatically updated to reflect the committed changes.