diff --git a/src/FixityCheckBatchCheck.php b/src/FixityCheckBatchCheck.php index eb7f373..8e45671 100644 --- a/src/FixityCheckBatchCheck.php +++ b/src/FixityCheckBatchCheck.php @@ -170,7 +170,7 @@ class FixityCheckBatchCheck { $results = &$context['results']; if (!isset($sandbox['offset'])) { $sandbox['offset'] = 0; - $sandbox['remaining'] = $storage->countPeriodic(); + $sandbox['count'] = $storage->countPeriodic(); $results['successful'] = 0; $results['ignored'] = 0; $results['skipped'] = 0; @@ -179,7 +179,8 @@ class FixityCheckBatchCheck { } $files = $storage->getPeriodic($sandbox['offset'], $batch_size); - $end = min($sandbox['remaining'], $sandbox['offset'] + count($files)); + + $end = min($sandbox['count'], $sandbox['offset'] + count($files)); $context['message'] = \t('Processing @start to @end', [ '@start' => $sandbox['offset'], '@end' => $end, @@ -187,12 +188,7 @@ class FixityCheckBatchCheck { static::check($files, $force, $results); $sandbox['offset'] = $end; - $remaining = $storage->countPeriodic(); - $progress_halted = $sandbox['remaining'] == $remaining; - $sandbox['remaining'] = $remaining; - - // End when we have exhausted all inputs or progress has halted. - $context['finished'] = empty($files) || $progress_halted; + $context['finished'] = ($sandbox['count'] <= $end); } /** diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 64cd4b6..cd87c08 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -141,7 +141,7 @@ class SettingsForm extends ConfigFormBase { '#title' => $this->t('Time elapsed'), '#description' => $this->t('

Time threshold is relative to "now". For example "-1 month" would prevent any checks that occurred less than a month ago.

-

Check Relative Formats for acceptable values

+

Check Relative Formats for acceptable values

'), '#default_value' => $config->get(static::THRESHOLD) ?: '-1 month', '#element_validate' => [ @@ -155,7 +155,7 @@ class SettingsForm extends ConfigFormBase { '#description' => $this->t('

Set how many files will be processed at once when performing a batch / cron job

'), - '#default_value' => 100, + '#default_value' => $config->get(static::BATCH_SIZE) ?: 100, ], ]; @@ -209,7 +209,7 @@ class SettingsForm extends ConfigFormBase { '#title' => $this->t('Time elapsed'), '#description' => $this->t('

Time threshold is relative to "now". For example "-1 week" would mean a week must pass between notifications.

-

Check Relative Formats for acceptable values

+

Check Relative Formats for acceptable values

'), '#default_value' => $notification_threshold, '#element_validate' => [ diff --git a/src/Plugin/QueueWorker/FixityCheckWorker.php b/src/Plugin/QueueWorker/FixityCheckWorker.php index 2bc09b5..65704e5 100644 --- a/src/Plugin/QueueWorker/FixityCheckWorker.php +++ b/src/Plugin/QueueWorker/FixityCheckWorker.php @@ -4,8 +4,8 @@ namespace Drupal\dgi_fixity\Plugin\QueueWorker; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Queue\QueueWorkerBase; -use Drupal\dgi_fixity\FixityCheckServiceInterface; use Drupal\dgi_fixity\FixityCheckInterface; +use Drupal\dgi_fixity\FixityCheckServiceInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /**