Skip to content

Commit e1eb326

Browse files
authored
Hacking lib to accept DELAY_SECONDS
1 parent 4009f32 commit e1eb326

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/ShopifyApp/Actions/DispatchWebhooks.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,17 @@ public function __invoke(ShopIdValue $shopId, bool $inline = false): bool
6666
$webhooks
6767
);
6868
} else {
69+
if (defined("{$this->jobClass}::DELAY_SECONDS")) {
70+
$delayTime = now()->addSecond(constant("{$this->jobClass}::DELAY_SECONDS"));
71+
} else {
72+
$delayTime = now();
73+
}
74+
6975
($this->jobClass)::dispatch(
7076
$shop->getId(),
7177
$webhooks
72-
)->onQueue(getShopifyConfig('job_queues')['webhooks']);
78+
)->delay($delayTime)
79+
->onQueue(getShopifyConfig('job_queues')['webhooks']);
7380
}
7481

7582
return true;

0 commit comments

Comments
 (0)