tmf: Improve synchronization in TmfRequestExecutor
If the TmfRequestExecutor is overwhelmed by event requests, it can
freeze the UI thread for long amounts of time and lead to a pretty
bad user experience. (An easy way to test this is to select an entry
with lots of state changes in the CFV, and hold down the right or left
arrow key.)
This patch:
- Makes it use Queue.offer() instead of .add(). This avoids spewing
exceptions in the console once the queues are full.
- Actually cancels the requests if the offer() fails. Before, even
though they would not be put in the queue, they would still exist
and still wait to execute.
- Drastically reduces the size of the request queues. If we are in a
case where the handler receives requests faster than it can process
them, instead of giving the user false hope that we will process them
in a reasonable time, just cancel them so that the UI can go back to
being responsive faster (see bufferbloat).
The "correct" fix would be to make sure on the request sender's side that
we don't send to many requests, and correctly cancel obsolete ones.
But independently of the sender's implementation, this patch makes the
executor degrade more gracefully.
Change-Id: I0072d54bb7a403773fd4288a42bfb73c4614189b
Reported-by: Simon Marchi <simon.marchi@ericsson.com>
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/32115
Tested-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
This page took 0.026252 seconds and 5 git commands to generate.