Merge lp:~roadmr/checkbox/lightning into lp:checkbox
Status: | Merged |
---|---|
Merged at revision: | 1276 |
Proposed branch: | lp:~roadmr/checkbox/lightning |
Merge into: | lp:checkbox |
Diff against target: |
180 lines (+53/-14) 6 files modified
checkbox/contrib/persist.py (+12/-9) checkbox/lib/safe.py (+4/-3) checkbox/message.py (+6/-2) debian/changelog (+2/-0) plugins/jobs_prompt.py (+15/-0) plugins/persist_info.py (+14/-0) |
To merge this branch: | bzr merge lp:~roadmr/checkbox/lightning |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marc Tardif (community) | Approve | ||
Review via email: mp+94284@code.launchpad.net |
Description of the change
This branch adds a way for the two main objects dealing with persisting stuff to disk (MessageStore and Persist) to decide whether or not they should use "safe" file closing (which flushes the file buffer and syncs to disk to ensure data integrity).
The default (and very robust) behavior is to use safe file closing, just as it has been since this feature was introduced in rev 1090.
It then adds a few methods in the persist_info and jobs_prompt plugins to *disable* safeness prior to starting the gathering phase, and reenable it right after finishing gathering.
In principle this should cause no data loss, since the gathered data is obtained automatically and thus the process can be very easily repeated if needed.
The benefit of doing all this juggling is a significant speed increase in gathering. My system goes from 37-40 seconds on the gathering phase to just under 7 seconds with these changes.
I'm not entirely happy by the handling of Persist's _backend directly (in persist_info). Maybe adding a method to Persist proper to then set the backend's safeness would be more kosher. But this seemed so much easier!
Very useful, thanks man! Just a couple comments about your code:
1. It is more Pythonish (or Pythonic?) to pass keyword arguments to function without spaces:
foo(a=1, b=2).
2. In plugins/ persist_ info.py, you access private variables from the persist object:
self. persist. _backend. safe_file_ closing = True
Instead, you might have liked to consider adding a public getter and setter on the Persist class:
self. persist. setSafeFileClos ing(True)
However, this doesn't prevent the code from working so I'm merging. All good!