$interval in EntityReferenceRevisionsOrphanPurger is always 0

Created on 8 September 2024, 4 months ago

Problem/Motivation

The time intervals in \Drupal\entity_reference_revisions\EntityReferenceRevisionsOrphanPurger are based on $this->time->getRequestTime();
Apparently a batch runs within one request, since start and end time are always the same timestamp, making the interval always 0.

Steps to reproduce

Proposed resolution

- Use getCurrentTime instead of getRequestTime
- Introduce a variable to store the start time of each individual batch.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇳🇱Netherlands spokje

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @spokje
  • Merge request !57First stab. → (Open) created by spokje
  • Pipeline finished with Success
    4 months ago
    Total: 191s
    #277163
  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • Pipeline finished with Success
    4 months ago
    Total: 422s
    #277186
  • Status changed to Needs work 4 months ago
  • 🇨🇭Switzerland berdir Switzerland

    > Apparently a batch runs within one request, since start and end time are always the same timestamp, making the interval always 0.

    This is not true for web batch processing, it's doing many HTTP requests and its' definitely not the same time.

    Maybe you've used this with drush, where things might be different?

    But the change isn't correct either, you stopped using $context['results'][$entity_type_id]['start'] and that's just plain wrong, you only compaare the start and end of a single batch method call instead of all calls.

Production build 0.71.5 2024