Project

Profile

Help

Refactor #2316

Updated by bmbouter about 8 years ago

This is a performance improvement story. As a Plugin developer when using an ancestor of pulp.app.models.ProgressReport every call to save() causes a round-trip write to the database. 

 For example as the documentation says: 

 <pre> 
 >>> with ProgressSpinner('Publishing Metadata'): 
 >>>       publish_metadata() 
 </pre> 

 After discussion on the ticket the following functionality is needed: 

 * Have It would be efficient to not save if a save call to increment() or save() skipped if it has been saved within the last 0.5 seconds. This implementation needs to occurred very recently. We also be for increment() in addition need to save() because increment() will likely not use save() anymore ensure that after Issue #2318 is implemented. I believe update() does not call save(). 
 * Only perform this behavior when we know some amount of time the context manager is being used. This should latest state will be set by __enter__() as an instance attribute on the in-memory ProgressReport object. 
 * Update the class docstrings to identify this behavior for plugin writers saved.

Back