-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow queue jobs with batches #4127
base: 3.1
Are you sure you want to change the base?
Changes from all commits
5fb48e1
94930cc
40c3f82
ecdf8d8
6826fa4
7276ee7
22adf92
5065171
b615bc9
6ede72a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Maatwebsite\Excel\Concerns; | ||
|
||
if (trait_exists('\Illuminate\Bus\Batchable')) { | ||
trait BatchableTrait | ||
{ | ||
use \Illuminate\Bus\Batchable; | ||
|
||
public function batchCancelled() | ||
{ | ||
$batch = $this->batch(); | ||
|
||
return $batch !== null && method_exists($batch, 'cancelled') && $batch->cancelled(); | ||
} | ||
} | ||
} else { | ||
trait BatchableTrait | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can add the methods we need else where like batchCancelled here as well, so we don't have to do a method_exist check there. We can return false here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
public function batchCancelled() | ||
{ | ||
return false; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Maatwebsite\Excel\Concerns; | ||
|
||
interface ShouldBatch | ||
{ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By doing this, it will execute as a chain with in the batch right? It won't run parallel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. This creates a batch and returns a PendingBatch.