@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $score = $this->lifetime !== -1 ? Carbon::now()->getTimestamp() : 0; |
| 30 | 30 | |
| 31 | - [$payload, $ids] = $this->connection->pipeline(function ($pipe) use ($id, $score): void { |
|
| 31 | + [$payload, $ids] = $this->connection->pipeline(function($pipe) use ($id, $score): void { |
|
| 32 | 32 | $pipe->eval(LuaScripts::get(), [self::JOB_PAYLOADS_KEY, self::FAILED_JOB_PAYLOADS_KEY, $id], 2); |
| 33 | 33 | $pipe->zrangebyscore(self::LIFETIME_FAILED_JOB_PAYLOADS_KEY, '-inf', (string) $score); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | 36 | if (count($ids)) { |
| 37 | - $this->connection->pipeline(function ($pipe) use ($ids, $score): void { |
|
| 37 | + $this->connection->pipeline(function($pipe) use ($ids, $score): void { |
|
| 38 | 38 | $pipe->hdel(self::FAILED_JOB_PAYLOADS_KEY, ...$ids); |
| 39 | 39 | $pipe->zremrangebyscore(self::LIFETIME_FAILED_JOB_PAYLOADS_KEY, '-inf', (string) $score); |
| 40 | 40 | }); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function set(string $id, string $serializedData): bool |
| 52 | 52 | { |
| 53 | - [$set] = $this->connection->pipeline(function ($pipe) use ($id, $serializedData): void { |
|
| 53 | + [$set] = $this->connection->pipeline(function($pipe) use ($id, $serializedData): void { |
|
| 54 | 54 | $pipe->hset(self::JOB_PAYLOADS_KEY, $id, $serializedData); |
| 55 | 55 | $pipe->zrem(self::LIFETIME_FAILED_JOB_PAYLOADS_KEY, $id); |
| 56 | 56 | }); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function removeFailed(string $id): bool |
| 72 | 72 | { |
| 73 | - [$deleted] = $this->connection->pipeline(function ($pipe) use ($id): void { |
|
| 73 | + [$deleted] = $this->connection->pipeline(function($pipe) use ($id): void { |
|
| 74 | 74 | $pipe->hdel(self::FAILED_JOB_PAYLOADS_KEY, $id); |
| 75 | 75 | $pipe->zrem(self::LIFETIME_FAILED_JOB_PAYLOADS_KEY, $id); |
| 76 | 76 | }); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function markAsFailed(string $id): bool |
| 82 | 82 | { |
| 83 | - [$marked] = $this->connection->pipeline(function ($pipe) use ($id): void { |
|
| 83 | + [$marked] = $this->connection->pipeline(function($pipe) use ($id): void { |
|
| 84 | 84 | $pipe->eval(LuaScripts::markAsFailed(), [self::JOB_PAYLOADS_KEY, self::FAILED_JOB_PAYLOADS_KEY, $id], 2); |
| 85 | 85 | $pipe->zadd(self::LIFETIME_FAILED_JOB_PAYLOADS_KEY, Carbon::now()->getTimestamp() + $this->lifetime, $id); |
| 86 | 86 | }); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public function flushFailed(): bool |
| 92 | 92 | { |
| 93 | - $result = $this->connection->pipeline(function ($pipe): void { |
|
| 93 | + $result = $this->connection->pipeline(function($pipe): void { |
|
| 94 | 94 | $pipe->del(self::FAILED_JOB_PAYLOADS_KEY); |
| 95 | 95 | $pipe->del(self::LIFETIME_FAILED_JOB_PAYLOADS_KEY); |
| 96 | 96 | }); |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | |
| 139 | 139 | private function prepareJobs($jobs): array |
| 140 | 140 | { |
| 141 | - return array_map(function ($job) { |
|
| 141 | + return array_map(function($job) { |
|
| 142 | 142 | return $this->prepareJob($job); |
| 143 | 143 | }, $jobs); |
| 144 | 144 | } |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $this->app->singleton(StoreResolver::class); |
| 38 | 38 | |
| 39 | - $this->app->singleton('heavy-jobs-store', function (Application $app) { |
|
| 39 | + $this->app->singleton('heavy-jobs-store', function(Application $app) { |
|
| 40 | 40 | return $app->make(PayloadStoreManager::class); |
| 41 | 41 | }); |
| 42 | 42 | |
| 43 | - $this->app->extend(QueueFactory::class, function (QueueManager $manager, Application $app) { |
|
| 43 | + $this->app->extend(QueueFactory::class, function(QueueManager $manager, Application $app) { |
|
| 44 | 44 | return new QueueManagerDecorator($manager, $app); |
| 45 | 45 | }); |
| 46 | 46 | |
| 47 | - $this->app->extend(FailedJobProviderInterface::class, function (FailedJobProviderInterface $provider) { |
|
| 47 | + $this->app->extend(FailedJobProviderInterface::class, function(FailedJobProviderInterface $provider) { |
|
| 48 | 48 | return new FailedJobProviderDecorator($provider); |
| 49 | 49 | }); |
| 50 | 50 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | private function registerPayloadCleaner(): void |
| 55 | 55 | { |
| 56 | - Queue::createPayloadUsing(function ($connection, $queue, $payload) { |
|
| 56 | + Queue::createPayloadUsing(function($connection, $queue, $payload) { |
|
| 57 | 57 | $job = Arr::get($payload, 'data.command'); |
| 58 | 58 | if ($job instanceof HeavyJob) { |
| 59 | 59 | return [ |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | return []; |
| 65 | 65 | }); |
| 66 | 66 | |
| 67 | - $this->app['events']->listen(JobProcessed::class, function (JobProcessed $event): void { |
|
| 67 | + $this->app['events']->listen(JobProcessed::class, function(JobProcessed $event): void { |
|
| 68 | 68 | if ($heavyPayloadId = Arr::get($event->job->payload(), 'heavy-payload-id')) { |
| 69 | 69 | HeavyJobsStore::remove($heavyPayloadId); |
| 70 | 70 | } |