Merge lp://staging/~canonical-ca-hackers/ubuntu-webcatalog/fix-scroll-backwards-error into lp://staging/ubuntu-webcatalog

Proposed by Łukasz Czyżykowski
Status: Merged
Approved by: Anthony Lenton
Approved revision: 174
Merged at revision: 176
Proposed branch: lp://staging/~canonical-ca-hackers/ubuntu-webcatalog/fix-scroll-backwards-error
Merge into: lp://staging/ubuntu-webcatalog
Diff against target: 87 lines (+20/-9)
3 files modified
src/webcatalog/management/commands/cleanup.py (+4/-3)
src/webcatalog/tasks.py (+0/-1)
src/webcatalog/tests/test_commands.py (+16/-5)
To merge this branch: bzr merge lp://staging/~canonical-ca-hackers/ubuntu-webcatalog/fix-scroll-backwards-error
Reviewer Review Type Date Requested Status
Anthony Lenton (community) Approve
Review via email: mp+123764@code.staging.launchpad.net

Commit message

Fix 'cursor can only scan forward' error on cleanup tasks.

Description of the change

Overview
========
This branch fixes error with cleanup tasks.

Details
=======
If the remove code would run longer than specified (or default) batch_time the calculation of batch_size would turn it to 0 or -1, which supplied to SQL FETCH would result in an error.

The simplest fix is to just set batch_size to 1 in that case. Documentation of PostgreSQL states that in the event that the cursor was exhausted it will just return 0 rows and not error.

To post a comment you must log in.
Revision history for this message
Anthony Lenton (elachuni) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches