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

--- Comment #47 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 209366
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209366&action=edit
Bug 42404: (follow-up) Finish BatchImportCoverImages jobs exactly once

The early returns in process() (upload not found, unreadable zip, no
valid mappings) only returned from the Try::Tiny block, so the job was
finished by _finish_failed() and then a second time after the block.
Unexpected exceptions, on the other hand, ended up with the 'finished'
status.

This patch makes the try block return whether the job failed, and the
job is finished once, after the block. The uploaded zip is deleted in a
single place, and unexpected exceptions now mark the job as 'failed'.

The extraction directory is now a File::Temp->newdir object, so it is
removed when process() is done instead of when the process exits.
File::Temp is now explicitly loaded, it was only available because
another module loaded it.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/BackgroundJob/BatchImportCoverImages.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Assisted-by: Opus 5.5 (Anthropic)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to