Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Commit e7841a6

Browse files
committed
Implement delay to (somewhat) ensure order of processing
1 parent 048bc35 commit e7841a6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Jobs/PostprocessVolumeImport.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,26 @@ public function handle()
4747
ProcessNewVolumeFiles::dispatch($volume);
4848
});
4949

50+
// Give the ProcessNewVolumeFiles jobs a head start so the file thumbnails are
51+
// generated (mostly) before the annotation thumbnails.
52+
$delay = now()->addSeconds(30);
53+
5054
if (class_exists(ProcessAnnotatedImage::class)) {
5155
Image::whereIn('images.volume_id', $this->ids)
5256
->whereHas('annotations')
53-
->eachById(function ($image) {
57+
->eachById(function ($image) use ($delay) {
5458
ProcessAnnotatedImage::dispatch($image)
59+
->delay($delay)
5560
->onQueue(config('largo.generate_annotation_patch_queue'));
5661
}, 1000);
5762
}
5863

5964
if (class_exists(ProcessAnnotatedVideo::class)) {
6065
Video::whereIn('videos.volume_id', $this->ids)
6166
->whereHas('annotations')
62-
->eachById(function ($video) {
67+
->eachById(function ($video) use ($delay) {
6368
ProcessAnnotatedVideo::dispatch($video)
69+
->delay($delay)
6470
->onQueue(config('largo.generate_annotation_patch_queue'));
6571
}, 1000);
6672
}

0 commit comments

Comments
 (0)