Process delayed jobs before they reach available_at #35477
Replies: 4 comments 4 replies
-
@paras-malhotra you mentiond "only queueing feature that was missing in Laravel" i think there is another one is this thread |
Beta Was this translation helpful? Give feedback.
-
I don't think it's a very common use case to process it before the delay is reached. None of the backend frameworks support this and it can be cumbersome to support with drivers such as Redis imo. |
Beta Was this translation helpful? Give feedback.
-
Can you share the use case? |
Beta Was this translation helpful? Give feedback.
-
Ok my use case: I crawls bunch of news websites and share theirs articles in my website, Some of them have more priority to the others say washingtonpost, So in my app i determined if the current article come from washingtonpost set a key in cache (db driver) and dispatch it otherwise delay any other for about 1 hour: if (Indexer::is() == 'washingtonpost') {
SendArticle::disptach(Indexer::link());
Cache::put('locked', true, now()->addHour());
} else {
if (Cache::has('locked')) {
SendArticle::dispatch(Indexer::link())->delay(now()->addHour());
} else {
SendArticle::dispatch(Indexer::link());
}
} And now imagine that all of the articles that comes after the washingtonpost are delayed at different times. For example, an article may be delayed for 1 hour after 10 minutes , etc... Say 10 article delayed in diffrenet times and ready to publish But the problem here is that whenever the key (locked) is deleted, not all articles are sent immediately because they are delayed at different times So i would really appreciate if there was something that checks if we have delayed jobs ? then dispatch all of them immediately! and dont wait until you reach if(DelayedJobs::exists())
{
DelayedJobs::disptachAll();
} Thanks for your responses guys much appreciated! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently there are no way process delayed job (before they reach the
available_at
, It would be nice if we could process all delayed job at the time with artisan https://stackoverflow.com/questions/65129474/how-to-process-delayed-jobs-before-they-reach-available-at@themsaid
Beta Was this translation helpful? Give feedback.
All reactions