add 5 second delay to queues

This commit is contained in:
Irfan 2019-05-12 16:50:46 +05:00
parent de9bb630d0
commit 7fe8bc5cb3
2 changed files with 8 additions and 1 deletions

View File

@ -20,6 +20,8 @@ CACHE_USER_EXPIRE=300
CACHE_404_EXPIRE=604800
CACHE_SEARCH_EXPIRE=432000
QUEUE_DELAY_PER_JOB=5
THROTTLE=false
THROTTLE_DECAY_MINUTES=1
THROTTLE_MAX_PER_DECAY_MINUTES=30

View File

@ -81,7 +81,12 @@ class JikanResponseHandler
// Don't duplicate the queue for same request
if (!app('redis')->exists($queueFingerprint)) {
app('redis')->set($queueFingerprint, 1);
dispatch(new UpdateCacheJob($request));
dispatch(
(new UpdateCacheJob($request))->delay(
env('QUEUE_DELAY_PER_JOB', 5)
)
);
} else {
Log::info("Duplicate ({$queueFingerprint})");
}