Merge lp:~facundo/ubuntuone-client/aq-better-waiting-structures into lp:ubuntuone-client
Status: | Merged |
---|---|
Approved by: | Facundo Batista |
Approved revision: | 913 |
Merged at revision: | 911 |
Proposed branch: | lp:~facundo/ubuntuone-client/aq-better-waiting-structures |
Merge into: | lp:ubuntuone-client |
Diff against target: |
601 lines (+198/-141) 2 files modified
tests/syncdaemon/test_action_queue.py (+155/-102) ubuntuone/syncdaemon/action_queue.py (+43/-39) |
To merge this branch: | bzr merge lp:~facundo/ubuntuone-client/aq-better-waiting-structures |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Facundo Batista (community) | Approve | ||
Lucio Torre (community) | Approve | ||
Review via email:
|
Commit message
Better waiting structures for 'conditions' and 'inactive queue' (LP: #720844)
Description of the change
Better waiting structures for 'conditions' and 'inactive queue'
Both types of waiting needs are very different, so there's an explanation
for each.
Wait for conditions, this rarely happen, so there is no problem to create a deferred for each command to lock in this case. The problem here was that on each "check_conditions" called (that happens frequently, and will happen more frequently after a bug is fixed in VM), *all* commands were called to check_conditions, and this could be very expensive when a lot of commands were queued.
Now, a waiting structure is created for this case. The command just locks through it, and the check conditions are called only through this self-locked commands.
Wait for active queue: this happened a lot (every time the client disconnected), and each time it happened, a deferred were created for each command queued, which could be very expensive memory-wise. Furthermore, when the queue was run again, all commands were sequentially called to unlock that deferred, which was expensive cpu-wise.
Now, a single deferred is used for all commands (that live in the queue). All commands wait for that deferred, and when the queue runs, it just triggers that deferred.
Tests included for everything.
Approving with one review