Description[Media Router] Connection reattempt logic and bound pending request queue size.
This patch address the following corner cases:
1. If OnConnectionError() is invoked while there are queued requests, this
happens when extension is woken up but MRPM did not register with MR
successfully.
2. Wake up extension failed.
3. After connection is established (RegisterMediaRouteProvider), we try to run
all pending requests, but it's possible that the extension is already suspended
at that point. It looks like an uncommon timing issue and does not appear to
indicate a connection error.
For 1 and 3, we will retry the wakeup (up to a max number of attempts) since
there is no way to tell if the error was transient. For 2, it is usually due to
a nonretriable error, so we will just drain the queue.
The retry / drain logic also ensures pending requests do not sit in the queue
indefinitely.
Also, introduced a max limit queue size. When the queue size exceeds that limit,
the oldest pending request will be dropped.
A couple of things considered but not implemented:
- Try to fail the pending request in some way instead of dropping them. First,
not all types of requests can be failed, i.e. majority of them do not contain
callbacks. Also because it is a corner case, the added complexity probably does
not justify it.
- Adding a permanent_failure bit to MediaRouterMojoImpl and automatically drop
requests if set to true. Locking down the media router due to connection error
feels too restrictive and I am not sure if it will help.
BUG=490787
Committed: https://crrev.com/3dbd73f561741c78541d1a323706f337fc4717d5
Cr-Commit-Position: refs/heads/master@{#357047}
Patch Set 1 #Patch Set 2 : #
Total comments: 4
Patch Set 3 : Addressed comments #Patch Set 4 : rebase #Patch Set 5 : #Patch Set 6 : Fix tests and teardown order #
Total comments: 2
Patch Set 7 : addressed Kevin's comment #Patch Set 8 : Rebase #
Messages
Total messages: 14 (4 generated)
|