@@ -150,51 +150,57 @@ private function registerDashboard(): void
150150 });
151151
152152 app ('events ' )->listen (JobProcessing::class, function (JobProcessing $ event ) {
153- if (!CloudTasks:: dashboardEnabled () ) {
153+ if (!$ event -> job instanceof CloudTasksJob ) {
154154 return ;
155155 }
156156
157- if ($ event -> job instanceof CloudTasksJob ) {
157+ if (CloudTasks:: dashboardEnabled () ) {
158158 DashboardService::make ()->markAsRunning ($ event ->job ->uuid ());
159159 }
160160 });
161161
162162 app ('events ' )->listen (JobProcessed::class, function (JobProcessed $ event ) {
163- data_set ($ event ->job ->job , 'internal.processed ' , true );
164-
165- if (!CloudTasks::dashboardEnabled ()) {
163+ if (!$ event ->job instanceof CloudTasksJob) {
166164 return ;
167165 }
168166
169- if ($ event ->job instanceof CloudTasksJob) {
167+ data_set ($ event ->job ->job , 'internal.processed ' , true );
168+
169+ if (CloudTasks::dashboardEnabled ()) {
170170 DashboardService::make ()->markAsSuccessful ($ event ->job ->uuid ());
171171 }
172172 });
173173
174174 app ('events ' )->listen (JobExceptionOccurred::class, function (JobExceptionOccurred $ event ) {
175- data_set ($ event ->job ->job , 'internal.errored ' , true );
176-
177- if (!CloudTasks::dashboardEnabled ()) {
175+ if (!$ event ->job instanceof CloudTasksJob) {
178176 return ;
179177 }
180178
181- DashboardService::make ()->markAsError ($ event );
179+ data_set ($ event ->job ->job , 'internal.errored ' , true );
180+
181+ if (CloudTasks::dashboardEnabled ()) {
182+ DashboardService::make ()->markAsError ($ event );
183+ }
182184 });
183185
184186 app ('events ' )->listen (JobFailed::class, function ($ event ) {
185- if (!CloudTasks:: dashboardEnabled () ) {
187+ if (!$ event -> job instanceof CloudTasksJob ) {
186188 return ;
187189 }
188190
189- DashboardService::make ()->markAsFailed ($ event );
191+ if (CloudTasks::dashboardEnabled ()) {
192+ DashboardService::make ()->markAsFailed ($ event );
193+ }
190194 });
191195
192196 app ('events ' )->listen (JobReleased::class, function (JobReleased $ event ) {
193- if (!CloudTasks:: dashboardEnabled () ) {
197+ if ($ event -> job instanceof CloudTasksJob ) {
194198 return ;
195199 }
196200
197- DashboardService::make ()->markAsReleased ($ event );
201+ if (CloudTasks::dashboardEnabled ()) {
202+ DashboardService::make ()->markAsReleased ($ event );
203+ }
198204 });
199205 }
200206}
0 commit comments