Skip to content

Commit

Permalink
add more config
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Feb 6, 2024
1 parent d00b113 commit fc821ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions config/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,22 @@
* null will fallback to the default laravel queue
*/
'queue' => null,

/**
* Customize WithoutOverlapping middleware settings
*/
'queue_overlapping' => [
/**
* Release value must be longer than the longest conversion job that might run
* Default is: 1 minute, increase it if you jobs are longer
*/
'release_after' => 60,
/**
* Expire value allow to forget a lock in case of the job failed in a unexpected way
*
* @see https://laravel.com/docs/10.x/queues#preventing-job-overlaps
*/
'expire_after' => 60 * 60,
],

];
4 changes: 2 additions & 2 deletions src/Jobs/ConversionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function withoutOverlapping(): WithoutOverlapping
{
return (new WithoutOverlapping("media:{$this->media->id}"))
->shared()
->releaseAfter(now()->addMinutes(1))
->expireAfter(now()->addMinutes(60));
->releaseAfter(config('media.queue_overlapping.release_after', 60))
->expireAfter(config('media.queue_overlapping.expire_after', 60 * 60));
}

public function uniqueId()
Expand Down

0 comments on commit fc821ed

Please sign in to comment.