Skip to content

Commit eecf3f8

Browse files
committed
Prevent monitoring dashboard from creating multiple tasks
1 parent 8f41ea1 commit eecf3f8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/DashboardService.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ private function getTaskBody(Task $task): string
3131

3232
public function add(string $queue, Task $task): void
3333
{
34+
$uuid = $this->getTaskUuid($task);
35+
36+
if (StackkitCloudTask::whereTaskUuid($uuid)->exists()) {
37+
return;
38+
}
39+
3440
$metadata = new TaskMetadata();
3541
$metadata->payload = $this->getTaskBody($task);
3642

@@ -51,7 +57,7 @@ public function add(string $queue, Task $task): void
5157

5258
DB::table('stackkit_cloud_tasks')
5359
->insert([
54-
'task_uuid' => $this->getTaskUuid($task),
60+
'task_uuid' => $uuid,
5561
'name' => $this->getTaskName($task),
5662
'queue' => $queue,
5763
'payload' => $this->getTaskBody($task),

0 commit comments

Comments
 (0)