[Koha-bugs] [Bug 30181] New: Koha::BackgroundJob->_derived_class returns an empty object

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Feb 25 10:39:30 CET 2022


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

            Bug ID: 30181
           Summary: Koha::BackgroundJob->_derived_class returns an empty
                    object
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: tomascohen at gmail.com
        QA Contact: testopia at bugs.koha-community.org

If you look at Koha::BackgroundJob->process, you will notice some funky stuff.
After re-reading how background_jobs_worker.pl does its job, you notice that
the main loop can only deal with Koha::BackgrounJob objects (i.e. not
Koha::BackgroundJob::BatchUpdateItem). This is because it either gets a job id
(STOMP use case) or it uses a Koha::BackgroundJobs->search to find jobs.

So, when a job is found (say $job), the worker eventually calls $job->process.
At that point, it needs to instantiate the 'real' class to properly call its
overridden ->process method. When it does so, it creates a new/empty object,
that is passed... the id. So, devs implementing background jobs need to take
care of retrieving the job object so they are able to update the job status.

This is not cool.

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


More information about the Koha-bugs mailing list