Skip to content

Commit 0589e26

Browse files
Merge pull request #130 from ted-selig-five9/patch-1
Fix "duplicate task" error
2 parents 1aca01b + 4ca8104 commit 0589e26

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/CloudTasksQueue.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private function taskName(string $queueName, array $payload): string
200200
$this->config['project'],
201201
$this->config['location'],
202202
$queueName,
203-
$displayName . '-' . $payload['uuid'] . '-' . Carbon::now()->getTimestamp(),
203+
$displayName . '-' . $payload['uuid'] . '-' . Carbon::now()->getTimeStampMs(),
204204
);
205205
}
206206

tests/QueueTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ public function it_adds_a_task_name_based_on_the_display_name()
495495
CloudTasksApi::assertTaskCreated(function (Task $task, string $queueName): bool {
496496
$uuid = \Safe\json_decode($task->getHttpRequest()->getBody(), true)['uuid'];
497497

498-
return $task->getName() === 'projects/my-test-project/locations/europe-west6/queues/barbequeue/tasks/Tests-Support-SimpleJob-' . $uuid . '-1685649757';
498+
return $task->getName() === 'projects/my-test-project/locations/europe-west6/queues/barbequeue/tasks/Tests-Support-SimpleJob-' . $uuid . '-1685649757000';
499499
});
500500
}
501501
}

tests/TaskHandlerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,11 @@ public function retried_jobs_get_a_new_name()
499499
CloudTasksApi::assertCreatedTaskCount(2);
500500
CloudTasksApi::assertTaskCreated(function (Task $task): bool {
501501
[$timestamp] = array_reverse(explode('-', $task->getName()));
502-
return $timestamp === '1685035628';
502+
return $timestamp === '1685035628000';
503503
});
504504
CloudTasksApi::assertTaskCreated(function (Task $task): bool {
505505
[$timestamp] = array_reverse(explode('-', $task->getName()));
506-
return $timestamp === '1685035629';
506+
return $timestamp === '1685035629000';
507507
});
508508
}
509509
}

0 commit comments

Comments
 (0)