File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,21 @@ protected function isTenantAware(JobProcessing|JobRetryRequested $event): bool
47
47
{
48
48
$ payload = $ this ->getEventPayload ($ event );
49
49
50
- $ command = unserialize ($ payload ['data ' ]['command ' ]);
50
+ try {
51
+ $ command = unserialize ($ payload ['data ' ]['command ' ]);
52
+ } catch (\Throwable ) {
53
+ /**
54
+ * We might need the tenant to unserialize jobs as models could
55
+ * have global scopes set that require a current tenant to
56
+ * be active. bindOrForgetCurrentTenant wil reset it.
57
+ */
58
+ if ($ tenantId = Context::get ($ this ->currentTenantContextKey ())) {
59
+ $ tenant = app (IsTenant::class)::find ($ tenantId );
60
+ $ tenant ?->makeCurrent();
61
+ }
62
+
63
+ $ command = unserialize ($ payload ['data ' ]['command ' ]);
64
+ }
51
65
52
66
$ job = $ this ->getJobFromQueueable ($ command );
53
67
You can’t perform that action at this time.
0 commit comments