Page MenuHomePhabricator

[services] Tunnelbroker - Removing processed messages
ClosedPublic

Authored by max on Nov 9 2022, 6:51 AM.
Tags
None
Referenced Files
F2172558: D5584.id18675.diff
Tue, Jul 2, 8:05 PM
Unknown Object (File)
Sat, Jun 29, 9:17 PM
Unknown Object (File)
Thu, Jun 27, 4:25 PM
Unknown Object (File)
Wed, Jun 26, 9:14 PM
Unknown Object (File)
Wed, Jun 26, 2:45 AM
Unknown Object (File)
Tue, Jun 25, 11:55 PM
Unknown Object (File)
Tue, Jun 25, 11:55 PM
Unknown Object (File)
Tue, Jun 25, 11:55 PM

Details

Summary

This diff adds removing of processed messages by the client from the database and handling of the incoming processedMessages gRPC message.
When the Tunnelbroker sends messages to the client by MessagesToDeliver (in D5540, D5580) we are expecting messages IDs back from the client as ProcessedMessages when they are successfully processed. After receiving the messages IDs the Tunnelbroker will remove messages from the database. Using this mechanism we are sure that the messages were successfully processed by the client before removing them.

Linear task: ENG-2060

Test Plan
  1. Insert a message into the messages table with the corresponding deviceID in the toDeviceID field.
  2. Connect by the gRPC client to the bidirectional stream with the sessionID corresponding to the deviceID in metadata.
  3. The message from the database would be delivered to the client as the MessagesToDeliver.
  4. Get the messageID identifier from the delivered message.
  5. Send back to the stream a processedMessages message with the message identifier.
  6. The expected result is that the message with the corresponding messageID will be removed from the database in messages table.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

max held this revision as a draft.
max edited the test plan for this revision. (Show Details)
max added reviewers: varun, marcin. max added 1 blocking reviewer(s): jon.
max published this revision for review.Nov 9 2022, 7:26 AM
max edited the summary of this revision. (Show Details)
max edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Nov 9 2022, 11:05 AM
This revision now requires review to proceed.Nov 10 2022, 2:17 AM

Change to pass the pointer of the Vector to c++ function.

tomek added inline comments.
services/tunnelbroker/src/server/mod.rs
290 ↗(On Diff #18309)

This is slightly confusing: this parameter messagesIDs is a vector of ids, but we seem to pass a single id processed_messages.message_id to it. Should we change some names to make it consistent?

This revision is now accepted and ready to land.Nov 17 2022, 3:24 AM
max added inline comments.
services/tunnelbroker/src/server/mod.rs
290 ↗(On Diff #18309)

This is slightly confusing: this parameter messagesIDs is a vector of ids, but we seem to pass a single id processed_messages.message_id to it. Should we change some names to make it consistent?

That came from the gRPC proto file field name. We should change it to be plural. I've created a task for this. Thanks!

max marked an inline comment as done.

Rebasing on parents and master changes.