Skip to content

Batch document sync jobs#70

Open
timkelty wants to merge 1 commit into
craftpulse:v5from
timkelty:timkelty/fix-batched-document-sync
Open

Batch document sync jobs#70
timkelty wants to merge 1 commit into
craftpulse:v5from
timkelty:timkelty/fix-batched-document-sync

Conversation

@timkelty

@timkelty timkelty commented Jun 16, 2026

Copy link
Copy Markdown

Description

Moves document sync onto Craft's batched queue job contract so large indexes can progress across spawned jobs without losing stale-document cleanup state.

Based on v5...imarc:craft-typesense:v5, but fixing some issues (cc @LinneaImarc)

  • It put flush/create side effects in loadData(). Since BaseBatchedJob reloads data for spawned batches, a flush job could delete/recreate the collection again on later batches.
  • It stored processed IDs in protected $upsertIds, which won’t survive queue serialization between spawned jobs. That makes stale cleanup only aware of the final batch.
  • It didn’t guarantee loadData() returns a Batchable on missing client/collection paths.
  • It batched the original criteria query without cloning or forcing stable ID ordering, which makes offset-based batching more fragile.

@timkelty timkelty force-pushed the timkelty/fix-batched-document-sync branch from 4af1399 to 1f62dad Compare June 16, 2026 19:10
@timkelty timkelty marked this pull request as ready for review June 16, 2026 19:22
@timkelty timkelty changed the title [v5] Batch document sync jobs Batch document sync jobs Jun 16, 2026
@LinneaHarts

Copy link
Copy Markdown

Thank you for the notes!

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.

2 participants