[services] Tunnelbroker - Fix calling blocking C++ function from an async task
Summary:
This diff fixes the calling of the blocking C++ function from an async Tokio task. Without this fix the scheduler first will run the blocking C++ function in a loop and put the async tasks in a queue after the blocking functions in a c++ thread. This causes an issue where the mpsc receiver will invoke a calling function only when the buffer size + 1 instead of on every push to the mpsc channel. As a result, the Tonic server will send messages to the stream only when the buffer size + 1 instead of every new message.
Full context in a linear task: ENG-3065
Test Plan:
- Start the Tunnelbroker server.
- Using gRPC client (i.e. BloomRPC) connect to the Tunnelbroker messages stream as a client 1.
- Using gRPC client (i.e. BloomRPC) connect to the Tunnelbroker messages stream as a client 2 in a separate tab.
- Send one message to client 2 from client 1.
- Client 2 will receive the message from client 1 in the messages stream.
Without this fix, the client will receive messages by two (mpsc buffer size + 1).
Reviewers: jon, varun, bartek
Reviewed By: varun, bartek
Subscribers: ashoat, tomek, atul
Differential Revision: https://phab.comm.dev/D6843