Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295547

Cleanup of batches is never performed, add batch cleanup after execution of batch

$
0
0

Problem/Motivation

For now, creating batches, using storage service, looks like \Drupal::service('batch.storage')->create($batch);. For instance, if batch defined as progressive, then it'll be created via the same construction inside of batch_process() function. Afterwards, when batch is finished and _batch_finished() executed, an entry will be deleted from storage by \Drupal::service('batch.storage')->delete($batch['id']);. Everything fine at the moment. My proposal is: take care about the storage and trigger the cleanup() method of the service inside of system_cron().

In addition to above, there could be a case when _batch_queue() function will try to construct wrong class. To resolve this, I propose to add an interface which will identify batch-related queues.

Proposed resolution

Add execution of \Drupal::service('batch.storage')->cleanup() to system_cron().

Remaining tasks

None.

User interface changes

None.

API changes

Add \Drupal\Core\Queue\BatchQueueInterface which must be implemented by every custom batch queue.

Data model changes

None.


Viewing all articles
Browse latest Browse all 295547


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>