Skip to content

Commit

Permalink
allow for comma separated webhooks endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
nivv committed May 29, 2024
1 parent 77f6931 commit 0d02d7b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/Actions/BustCacheWithWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ public function handle(Collection $tagsToFlush)
key: hash('adler32', json_encode($tagsToFlush)),
maxAttempts: 1,
callback: function () use ($tagsToFlush) {
WebhookCall::create()
->url(config('fabriq.webhooks.endpoint'))
->payload([
'type' => 'cache_expiration',
'invalid_cache_tags' => $tagsToFlush->toArray(),
])
->useSecret(config('fabriq.webhooks.secret'))
->dispatch();
foreach (explode(',', config('fabriq.webhooks.endpoint')) as $url) {
WebhookCall::create()
->url($url)
->payload([
'type' => 'cache_expiration',
'invalid_cache_tags' => $tagsToFlush->toArray(),
])
->useSecret(config('fabriq.webhooks.secret'))
->dispatch();
}
},
decaySeconds: 1
);
Expand Down

0 comments on commit 0d02d7b

Please sign in to comment.