Skip to content

Fix batch progress tracking causing infinite loop - #23

Open
jjroelofs wants to merge 2 commits into
feature/centralized-batch-processingfrom
jur/feature/centralized-batch-processing/#20-fix-batch-progress
Open

Fix batch progress tracking causing infinite loop#23
jjroelofs wants to merge 2 commits into
feature/centralized-batch-processingfrom
jur/feature/centralized-batch-processing/#20-fix-batch-progress

Conversation

@jjroelofs

Copy link
Copy Markdown
Contributor

Summary

Fixes #20. processBatch() calculated $context['finished'] as a fraction of total entities across all operations, but the form creates one batch operation per chunk of 5. After processing a chunk, finished was e.g. 5/100 = 0.05, so Drupal re-invoked the same operation endlessly instead of advancing to the next chunk.

Changes

  • Set $context['finished'] = 1 at the end of each chunk since each chunk is a separate complete batch operation

Test plan

  • Run batch with limit < total entities (e.g. 100 on a type with 112 nodes), verify batch completes without Ajax error
  • Verify progress bar advances through all chunks

Jurriaan Roelofs added 2 commits May 11, 2026 13:42
processBatch() calculated $context['finished'] as a fraction of total
entities across all operations, but the form creates one batch
operation per chunk of 5. After processing a chunk, finished was e.g.
5/100 = 0.05, so Drupal re-invoked the same operation endlessly
instead of advancing to the next chunk.

Set finished = 1 at the end of each chunk since each chunk is a
separate complete batch operation.

Closes #20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant