[Koha-bugs] [Bug 18855] Fines cronjob can cause duplicate fines if run during active circulation

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Dec 3 00:30:45 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18855

Michael Hafen <michael.hafen at washk12.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Failed QA                   |In Discussion

--- Comment #11 from Michael Hafen <michael.hafen at washk12.org> ---
(In reply to Jonathan Druart from comment #10)
> Can you provide tests, please?

Looking through the db_dependent/Overdues.t file I notice that Koha expects a
new fine to be generated if an overdue book is renewed and then becomes overdue
again.  This complicates things since a book renewed just after the cronjob
starts could look like it was renewed previously and became overdue again.

Now I'm trying to think of how to tell the difference between a book renewed a
couple weeks ago (for example) and a book renewed after the cronjob started.

Does the cronjob/fines.pl script need to pull the fines status again just
before updating the fine to make sure the status hasn't changed, instead of
changing how C4::Overdues::UpdateFine() handles status?  But then we'd have to
make the cronjob lock the database at the point of refreshing the status and
updating the fine; otherwise we've only reduced the window on the race
condition (to nearly nil).  Or is the very small chance of a race condition
good enough? (I don't think it is, but I don't like locking the database during
operating hours either.)

I'm going to chose the locking option, and make a new patch to do that. 
(Bonus, I don't have to write a test case ;) )

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list