Problem/Motivation
Database backend is getting current time for each of queued jobs but for no reason
Steps to reproduce
https://git.drupalcode.org/project/advancedqueue/-/blob/8.x-1.x/src/Plug...
Proposed resolution
\Drupal\advancedqueue\Plugin\AdvancedQueue\Backend\Database::enqueueJobs() should use pre-calculate "AvailableTime" for each job which missing job's override
Remaining tasks
review/commit
User interface changes
no
API changes
no
Data model changes
no
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3165480-4.patch | 2.19 KB | andypost |
| #4 | interdiff.txt | 1.94 KB | andypost |
| #3 | 3165480-3-test-only.patch | 1.03 KB | andypost |
Comments
Comment #2
andypostComment #3
andypostAnd here's a test
Comment #4
andypostExtend testing and prevent recalculate when no jobs passed
Comment #5
jonathanshawComment #6
bojanz commentedI dislike this fix, it's not readable and it takes time to understand.
There is no need to have the whole $available_time expression inside the setter call. Just define:
above the foreach, and then always use it in the if (i$job->getAvailableTime()).
I also don't think this change needs a test, since it is a performance optimization, not changed business logic.