HomePhabricator
Diffusion Comm 715c6f9c1fcc

[services] Tunnelbroker - Adding the pinging loop and online status of the…

Description

[services] Tunnelbroker - Adding the pinging loop and online status of the client check

Summary:
This diff introduces a pinging messages loop implementation to make sure that the stream is alive and the client is online because gRPC doesn't provide the keep-alive checks out of the box. The full context is available in the ENG-1766 task.
We are also changing the client's (session) online status in the database when the client became online or the stream is dropped or closed.

Linear task: ENG-2060

Test Plan:
Testing pinging of the device and its online status:
Monitoring the value of the isOnline field in the tunnelbroker-device-sessions database table.

  • Connecting to the bidirectional stream with the valid sessionID in metadata results in the value changing to true right after connection.
  • Disconnecting from the stream or closing the client, resulting in the value becoming false in the `tunnelbroker-device-sessions database table in no more than 3 seconds (pinging interval).

Reviewers: jon, marcin

Reviewed By: jon

Subscribers: ashoat, tomek, atul, abosh

Differential Revision: https://phab.comm.dev/D5529