Skip to content

Commit 35e6b27

Browse files
author
James William Dumay
authored
Update CloudTasksQueue.php
1 parent 20bad3c commit 35e6b27

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/CloudTasksQueue.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected function pushToCloudTasks($queue, $payload, $delay = 0)
152152
$httpRequest->setBody($payload);
153153

154154
$task = $this->createTask();
155-
$task->setName($this->taskName($uuid, $displayName));
155+
$task->setName($this->taskName($queueName, $uuid, $displayName));
156156
$task->setHttpRequest($httpRequest);
157157

158158
// The deadline for requests sent to the app. If the app does not respond by
@@ -178,9 +178,14 @@ protected function pushToCloudTasks($queue, $payload, $delay = 0)
178178
return $uuid;
179179
}
180180

181-
private function taskName(string $uuid, string $displayName) {
181+
private function taskName(string $queueName, string $uuid, string $displayName) {
182+
$config = $this->config;
183+
$projectId = $config['project'];
184+
$location = $config['location'];
185+
$queueId = $queueName;
186+
// projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID
182187
$displayName = str_replace("\\", "-", $displayName);
183-
return sprintf('%s-%s', $uuid, $displayName);
188+
return sprintf('projects/%s/locations/%s/queues/%s/tasks/%s-%s', $projectId, $location, $queueId, $uuid, $displayName);
184189
}
185190

186191
private function extractPayload(string $payload): array

0 commit comments

Comments
 (0)