Export FromQuery not queued correctly with database connection #3624
Answered
by
arthurshlain
arthurshlain
asked this question in
Q&A
-
Hi there. With But when I use There is no failed jobs in database.
My export class: class BillsExport implements FromQuery, ShouldQueue, WithHeadings, WithMapping, ShouldAutoSize {
use Exportable;
public $village_id = 0;
public $from = null;
public $to = null;
public function __construct( $village_id, $from = null, $to = null ) {
TelegramBot::sendMessage('BillExport __construct() called');
$this->village_id = $village_id;
$this->from = $from;
$this->to = $to;
}
public function failed( Throwable $exception ): void {
TelegramBot::sendMessage( 'BillsExport exception: ' . $exception->getMessage() );
}
public function query() {
$from = $this->from;
$to = $this->to;
TelegramBot::sendMessage('BillExport query() called');
return Bill::query()
->with('user')
->whereVillageId( $this->village_id )
->when( $from !== null, function ( $q ) use ( $from ) {
return $q->where( 'date', '>=', $from );
} )
->when( $to !== null, function ( $q ) use ( $to ) {
return $q->where( 'date', '<=', $to );
} );
}
public function headings(): array {
TelegramBot::sendMessage('BillExport headings() called');
return [
'#',
'Owner',
'Plot',
'Amount',
'Date',
];
}
public function map( $bill ): array {
TelegramBot::sendMessage('BillExport map() called');
return [
$bill->number,
$bill->user->fullName,
$bill->user->plotsCommaSeparated(),
$bill->amount_total,
$bill->date
];
}
} My supervisor conf file:
Result with QUEUE_CONNECTION=database
Result with QUEUE_CONNECTION=sync
What could be the problem? |
Beta Was this translation helpful? Give feedback.
Answered by
arthurshlain
May 20, 2022
Replies: 1 comment
-
Solved by |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
arthurshlain
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solved by
sudo supervisorctl reload