File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ public function handle(): void
5454 ->orWhereNotNull ('certificate_generation_error ' );
5555 });
5656
57- $ rows = $ query ->offset ( $ this -> offset )-> limit (self ::BATCH_SIZE )->get ();
57+ $ rows = $ query ->limit (self ::BATCH_SIZE )->get ();
5858
5959 if ($ rows ->isEmpty ()) {
6060 Cache::forget ($ runningKey );
@@ -101,19 +101,17 @@ public function handle(): void
101101 }
102102 }
103103
104- $ nextOffset = $ this ->offset + $ rows ->count ();
105104 $ hasMore = Excellence::query ()
106105 ->where ('edition ' , $ this ->edition )
107106 ->where ('type ' , $ this ->type )
108107 ->where (function ($ q ) {
109108 $ q ->whereNull ('certificate_url ' )->orWhereNotNull ('certificate_generation_error ' );
110109 })
111- ->offset ($ nextOffset )
112110 ->limit (1 )
113111 ->exists ();
114112
115113 if ($ hasMore && ! Cache::get ($ cancelledKey )) {
116- self ::dispatch ($ this ->edition , $ this ->type , $ nextOffset );
114+ self ::dispatch ($ this ->edition , $ this ->type , 0 );
117115 } else {
118116 Cache::forget ($ runningKey );
119117 }
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public function handle(): void
4444 ->with ('user ' )
4545 ->orderBy ('id ' );
4646
47- $ rows = $ query ->offset ( $ this -> offset )-> limit (self ::BATCH_SIZE )->get ();
47+ $ rows = $ query ->limit (self ::BATCH_SIZE )->get ();
4848
4949 foreach ($ rows as $ excellence ) {
5050 $ user = $ excellence ->user ;
@@ -70,20 +70,18 @@ public function handle(): void
7070 }
7171 }
7272
73- $ nextOffset = $ this ->offset + $ rows ->count ();
7473 $ hasMore = Excellence::query ()
7574 ->where ('edition ' , $ this ->edition )
7675 ->where ('type ' , $ this ->type )
7776 ->whereNotNull ('certificate_url ' )
7877 ->where (function ($ q ) {
7978 $ q ->whereNull ('notified_at ' )->orWhereNotNull ('certificate_sent_error ' );
8079 })
81- ->offset ($ nextOffset )
8280 ->limit (1 )
8381 ->exists ();
8482
8583 if ($ hasMore ) {
86- self ::dispatch ($ this ->edition , $ this ->type , $ nextOffset );
84+ self ::dispatch ($ this ->edition , $ this ->type , 0 );
8785 } else {
8886 Cache::forget ($ runningKey );
8987 }
You can’t perform that action at this time.
0 commit comments