ts-odd icon indicating copy to clipboard operation
ts-odd copied to clipboard

Account linking: Concurrent linking requests

Open bgins opened this issue 3 years ago • 0 comments

Summary

An account linking producer concurrently tracks requests to link from multiple consumers.

Problem

In the current implementation of account linking (see #335), a producer will only handle one linking request at a time. The producer ignores concurrent requests, and consumers poll until the producer is ready to handle them.

This approach does not work reliably and would be significantly improved if the producer tracked multiple consumers at once.

Impact

Without this feature, there may be failure cases when a user tries to link more than one device at a time.

Solution

We should consider the following when implementing this feature:

Manual pin entry

In the current implementation, the account linking consumer generates a pin that is displayed in the consumer and the producer. The user confirms the pin in the producer to complete the linking process.

We could instead ask the user to enter the pin in the producer. The producer would track pins for multiple consumers and link whichever consumer matches the pin entered by the user (or display an error if none match).

Manual pin entry would require an update to the AWAKE protocol. See #337 for more details.

Selective message reception queue

Rather than ignoring consumers, the producer should track their messages in a queue. Each message should have enough information to identify the consumer who sent it. The producer would scan the queue and handle each message as appropriate for each consumer.

We will also want to implement a queue in the consumer. Although the consumer is simpler, dropping irrelevant messages adds complexity that could be avoided by tracking messages and selecting the relevant ones from the queue.

For some additional context on selective message reception, it's worth watching: https://www.infoq.com/presentations/Death-by-Accidental-Complexity/

bgins avatar Mar 17 '22 18:03 bgins