Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117815951
D5116.1775285004.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D5116.1775285004.diff
View Options
diff --git a/src/app/Jobs/WalletCharge.php b/src/app/Jobs/WalletCharge.php
--- a/src/app/Jobs/WalletCharge.php
+++ b/src/app/Jobs/WalletCharge.php
@@ -6,6 +6,8 @@
class WalletCharge extends CommonJob
{
+ public const QUEUE = 'background';
+
/** @var int How many times retry the job if it fails. */
public $tries = 5;
@@ -25,6 +27,7 @@
public function __construct(string $walletId)
{
$this->walletId = $walletId;
+ $this->onQueue(self::QUEUE);
}
/**
diff --git a/src/app/Jobs/WalletCheck.php b/src/app/Jobs/WalletCheck.php
--- a/src/app/Jobs/WalletCheck.php
+++ b/src/app/Jobs/WalletCheck.php
@@ -12,6 +12,8 @@
public const THRESHOLD_REMINDER = 'reminder';
public const THRESHOLD_INITIAL = 'initial';
+ public const QUEUE = 'background';
+
/** @var int How many times retry the job if it fails. */
public $tries = 5;
@@ -35,6 +37,7 @@
public function __construct(string $walletId)
{
$this->walletId = $walletId;
+ $this->onQueue(self::QUEUE);
}
/**
diff --git a/src/config/horizon.php b/src/config/horizon.php
--- a/src/config/horizon.php
+++ b/src/config/horizon.php
@@ -144,7 +144,7 @@
'production' => [
'supervisor-1' => [
'connection' => 'redis',
- 'queue' => ['default', App\Jobs\MailJob::QUEUE],
+ 'queue' => ['default', App\Jobs\MailJob::QUEUE, 'background'],
'balance' => 'auto',
'maxProcesses' => 1,
'minProcesses' => 1,
@@ -155,7 +155,7 @@
'local' => [
'supervisor-1' => [
'connection' => 'redis',
- 'queue' => ['default', App\Jobs\MailJob::QUEUE],
+ 'queue' => ['default', App\Jobs\MailJob::QUEUE, 'background'],
'balance' => 'auto',
'maxProcesses' => 1,
'minProcesses' => 1,
diff --git a/src/tests/Feature/Jobs/WalletCheckTest.php b/src/tests/Feature/Jobs/WalletCheckTest.php
--- a/src/tests/Feature/Jobs/WalletCheckTest.php
+++ b/src/tests/Feature/Jobs/WalletCheckTest.php
@@ -49,6 +49,9 @@
$job = new WalletCheck($wallet->id);
$job->handle();
+ // Ensure the job ends up on the correct queue
+ $this->assertSame(WalletCheck::QUEUE, $job->queue);
+
Mail::assertNothingSent();
// Balance is negative now
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 6:43 AM (13 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18820136
Default Alt Text
D5116.1775285004.diff (2 KB)
Attached To
Mode
D5116: Move wallet processing to a background queue
Attached
Detach File
Event Timeline