Project

Profile

Help

Refactor #2316

closed

Batch save() calls to ProgressReport

Added by bmbouter about 8 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Sprint:
Sprint 18
Quarter:

Description

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:

>>> with ProgressSpinner('Publishing Metadata'):
>>>     publish_metadata()

After discussion on the ticket the following functionality is needed:

  • Have a call to increment() or save() skipped if it has been saved within the last 0.5 seconds. This implementation needs to also be for increment() in addition to save() because increment() will likely not use save() anymore after Issue #2318 is implemented. I believe update() does not call save().
  • Only perform this behavior when we know the context manager is being used. This should 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

Also available in: Atom PDF