Skip to content

Commit

Permalink
Fix exception
Browse files Browse the repository at this point in the history
  • Loading branch information
riasvdv committed Aug 23, 2024
1 parent 65d0ba4 commit 4c2db0e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Actions/MakeQueueTenantAwareAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,21 @@ protected function isTenantAware(JobProcessing|JobRetryRequested $event): bool
{
$payload = $this->getEventPayload($event);

$command = unserialize($payload['data']['command']);
try {
$command = unserialize($payload['data']['command']);
} catch (\Throwable) {
/**
* We might need the tenant to unserialize jobs as models could
* have global scopes set that require a current tenant to
* be active. bindOrForgetCurrentTenant wil reset it.
*/
if ($tenantId = Context::get($this->currentTenantContextKey())) {
$tenant = app(IsTenant::class)::find($tenantId);
$tenant?->makeCurrent();
}

$command = unserialize($payload['data']['command']);
}

$job = $this->getJobFromQueueable($command);

Expand Down

0 comments on commit 4c2db0e

Please sign in to comment.