Page MenuHomePhabricator

[services] Tunnelbroker - Update sending of the `newNotifyTokenRequired` in `Get` stream request
ClosedPublic

Authored by max on Sep 21 2022, 4:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 4:44 AM
Unknown Object (File)
Sat, Oct 26, 2:30 AM
Unknown Object (File)
Oct 23 2024, 1:53 PM
Unknown Object (File)
Oct 23 2024, 1:43 PM
Unknown Object (File)
Oct 9 2024, 8:44 PM
Unknown Object (File)
Oct 8 2024, 8:31 AM
Unknown Object (File)
Oct 8 2024, 8:31 AM
Unknown Object (File)
Oct 8 2024, 8:31 AM

Details

Summary

This diff introduces sending of the newNotifyTokenRequired to the client in Get stream request.
When the device has an invalid or expired notification token it's empty in the database and we are requesting a new token from the client using the newNotifyTokenRequired response.
The client gets back with the new token in Get stream request when starts listening for new messages (getting messages) from the Tunnelbroker (ref to D5206).

This is a part of the stack.
This approach was used keeping in mind the transition to the bidirectional stream soon.

Related Linear task: ENG-1782 and ENG-1816

Test Plan

Successfully built the service and passed unit and integration tests.

Diff Detail

Repository
rCOMM Comm
Branch
handler-update-device-token-request
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

max held this revision as a draft.
max published this revision for review.Sep 21 2022, 4:11 PM
max edited the summary of this revision. (Show Details)
max edited the test plan for this revision. (Show Details)
max added a reviewer: tomek.
tomek added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
199–201 ↗(On Diff #16969)

Is it really failed? I guess it depends, because sending a response where we inform that a new token is required sounds like a success. But making it a failure also makes some sense. So up to you.

This revision is now accepted and ready to land.Sep 23 2022, 5:11 AM
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
199–201 ↗(On Diff #16969)

We should not fail. Some devices will not have a notifyToken

tomek requested changes to this revision.Sep 23 2022, 5:21 AM
This revision now requires changes to proceed.Sep 23 2022, 5:21 AM

Removing return of error if the device token is empty.

max added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
199–201 ↗(On Diff #16969)

Is it really failed? I guess it depends, because sending a response where we inform that a new token is required sounds like a success. But making it a failure also makes some sense. So up to you.

We should not fail. Some devices will not have a notifyToken

Makes sense to remove returning of the error here.
I've removed the return of error here.

tomek added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
188–189

Shouldn't we fetch the session item again after this update?

194–198

Shouldn't we clear the response after it is sent?

This revision is now accepted and ready to land.Sep 23 2022, 7:52 AM
max marked 2 inline comments as done.

Adding of request cleaning.
Adding of session re-fetching after token update.
Resolving merge conflict.

max added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
188–189

Shouldn't we fetch the session item again after this update?

Nice catch! I've added refetching of the session after the token update.

194–198

Shouldn't we clear the response after it is sent?

Yes, that makes sense! I've added the .Clean() here.

This revision was landed with ongoing or failed builds.Sep 23 2022, 1:13 PM
This revision was automatically updated to reflect the committed changes.
max marked an inline comment as done.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
188–189

The fact that this was caught during the review suggests that this functionality wasn't tested thoroughly. Could you test if setting new token works properly? Have you checked it before this change?

max added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
188–189

The fact that this was caught during the review suggests that this functionality wasn't tested thoroughly. Could you test if setting new token works properly? Have you checked it before this change?

Sure, I'll re-test all the API flow and will re-check it now (I'm testing now using httpyac script ) The fact that this condition was lost in this certain diff was the result of the code merging from my side.

Thanks, @tomek !

max added inline comments.
services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
188–189

The fact that this was caught during the review suggests that this functionality wasn't tested thoroughly. Could you test if setting new token works properly? Have you checked it before this change?

Sure, I'll re-test all the API flow and will re-check it now (I'm testing now using httpyac script ) The fact that this condition was lost in this certain diff was the result of the code merging from my side.

Thanks, @tomek !

By the way, upcoming integration tests in CI will catch such errors.