File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class BatchRetryCommand extends Command
19
19
{--limit= : Limit the amount of jobs to retry}
20
20
{--queue= : Only retry on a specific queue}
21
21
{--filter= : Filter by a specific string. This will be a search in the payload of the job}
22
+ {--exclude-filter= : Filter by excluding a specific string. This will be a search in the payload of the job}
22
23
{--filter-by-exception= : Filter by a specific string on the exception.}
23
24
{--dry-run : Do a dry run of the batch retry to have an idea of the size of the batch} ' ;
24
25
@@ -57,6 +58,9 @@ public function handle()
57
58
->when ($ this ->option ('filter ' ), function ($ query ) {
58
59
$ query ->where ('payload ' , 'like ' , '% ' .$ this ->option ('filter ' ).'% ' );
59
60
})
61
+ ->when ($ this ->option ('exclude-filter ' ), function ($ query ) {
62
+ $ query ->where ('payload ' , 'not like ' , '% ' .$ this ->option ('exclude-filter ' ).'% ' );
63
+ })
60
64
->when ($ this ->option ('filter-by-exception ' ), function ($ query ) {
61
65
$ query ->where ('exception ' , 'like ' , '% ' .$ this ->option ('filter-by-exception ' ).'% ' );
62
66
});
Original file line number Diff line number Diff line change @@ -90,6 +90,25 @@ public function it_can_batch_retry_using_search()
90
90
$ this ->assertNotNull ($ someOtherFailedJob ->fresh ());
91
91
}
92
92
93
+ /** @test */
94
+ public function it_can_batch_retry_using_excluded_search ()
95
+ {
96
+ $ someFailedJob = factory (FailedJob::class)->create ([
97
+ 'payload ' => ['displayName ' => 'App\Jobs\SomeJob ' ]
98
+ ]);
99
+ $ someOtherFailedJob = factory (FailedJob::class)->create ([
100
+ 'payload ' => ['displayName ' => 'App\Jobs\SomeOtherJob ' ]
101
+ ]);
102
+
103
+ Artisan::call ('queue:failed:batch-retry ' , [
104
+ '--exclude-filter ' => 'SomeJob ' ,
105
+ ]);
106
+
107
+ $ this ->assertEquals (1 , DB ::table ('jobs ' )->count ());
108
+ $ this ->assertNotNull ($ someFailedJob ->fresh ());
109
+ $ this ->assertNull ($ someOtherFailedJob ->fresh ());
110
+ }
111
+
93
112
/** @test */
94
113
public function it_can_batch_retry_limiting_by_date ()
95
114
{
You can’t perform that action at this time.
0 commit comments