File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -278,19 +278,23 @@ public function shouldSend(): bool
278278 return $ this ->configurationsPasses () && $ this ->whenPasses () && $ this ->eventsPasses ();
279279 }
280280
281- public static function run ()
281+ public function execute (): void
282282 {
283- static ::query ()
284- ->get ()->lazy ()
285- ->filter (fn (self $ schedule ) => $ schedule ->shouldSend ())
286- ->filter (fn (self $ schedule ) => $ schedule ->hasCustomAction ())
287- ->each (fn (self $ schedule ) => app ($ schedule ->action )->handle ($ schedule ));
283+ $ this ->save ();
288284
285+ if ($ this ->hasCustomAction ()) {
286+ app ($ this ->action )->handle ($ this );
287+ } else {
288+ dispatch (new SendMailJob ($ this ));
289+ }
290+ }
291+
292+ public static function run (): void
293+ {
289294 static ::query ()
290- ->get ()-> lazy ()
295+ ->cursor ()
291296 ->filter (fn (self $ schedule ) => $ schedule ->shouldSend ())
292- ->filter (fn (self $ schedule ) => ! $ schedule ->hasCustomAction ())
293- ->each (fn (self $ schedule ) => dispatch (new SendMailJob ($ schedule )));
297+ ->each (fn (self $ schedule ) => $ schedule ->execute ());
294298 }
295299
296300 public function hasCustomAction (): bool
You can’t perform that action at this time.
0 commit comments