mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Integrate Push with Queue
This commit is contained in:
parent
a1abf5016f
commit
b4e7d4aaad
1 changed files with 18 additions and 0 deletions
|
|
@ -402,6 +402,13 @@ class Push
|
|||
*/
|
||||
public function send(): bool
|
||||
{
|
||||
// If queue is enabled, send asynchronously.
|
||||
if (config('queue.enabled') && !defined('RXQUEUE_CRON'))
|
||||
{
|
||||
Queue::addTask(self::class . '::' . 'sendAsync', $this);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get caller information.
|
||||
$backtrace = debug_backtrace(0);
|
||||
if(count($backtrace) && isset($backtrace[0]['file']))
|
||||
|
|
@ -464,6 +471,17 @@ class Push
|
|||
return $this->sent > 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send asynchronously (for Queue integration).
|
||||
*
|
||||
* @param self $sms
|
||||
* @return void
|
||||
*/
|
||||
public static function sendAsync(self $push): void
|
||||
{
|
||||
$push->send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device token
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue