Skip to content

Commit

Permalink
feat: allow classes that extends AbstractJob to be placed on a specif…
Browse files Browse the repository at this point in the history
…ic queue
  • Loading branch information
imorland committed Sep 26, 2024
1 parent e43530e commit 7fabbfb
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions extensions/mentions/src/Job/SendMentionsNotificationsJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class SendMentionsNotificationsJob extends AbstractJob

public function __construct(CommentPost $post, array $userMentions, array $postMentions, array $groupMentions)
{
parent::__construct();

$this->post = $post;
$this->userMentions = $userMentions;
$this->postMentions = $postMentions;
Expand Down
2 changes: 2 additions & 0 deletions extensions/package-manager/src/Job/ComposerCommandJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ComposerCommandJob extends AbstractJob implements ShouldBeUnique

public function __construct(AbstractActionCommand $command, string $phpVersion)
{
parent::__construct();

$this->command = $command;
$this->phpVersion = $phpVersion;
}
Expand Down
2 changes: 2 additions & 0 deletions extensions/pusher/src/SendPusherNotificationsJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class SendPusherNotificationsJob extends AbstractJob

public function __construct(BlueprintInterface $blueprint, array $recipients)
{
parent::__construct();

$this->blueprint = $blueprint;
$this->recipients = $recipients;
}
Expand Down
2 changes: 2 additions & 0 deletions framework/core/src/Mail/Job/SendRawEmailJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class SendRawEmailJob extends AbstractJob

public function __construct(string $email, string $subject, string $body)
{
parent::__construct();

$this->email = $email;
$this->subject = $subject;
$this->body = $body;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class SendEmailNotificationJob extends AbstractJob

public function __construct(MailableInterface $blueprint, User $recipient)
{
parent::__construct();

$this->blueprint = $blueprint;
$this->recipient = $recipient;
}
Expand Down
2 changes: 2 additions & 0 deletions framework/core/src/Notification/Job/SendNotificationsJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class SendNotificationsJob extends AbstractJob

public function __construct(BlueprintInterface $blueprint, array $recipients = [])
{
parent::__construct();

$this->blueprint = $blueprint;
$this->recipients = $recipients;
}
Expand Down
10 changes: 10 additions & 0 deletions framework/core/src/Queue/AbstractJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@ class AbstractJob implements ShouldQueue
use InteractsWithQueue;
use Queueable;
use SerializesModels;

public static ?string $onQueue = null;

public function __construct()
{
if (static::$onQueue) {
$this->onQueue(static::$onQueue);
}
}

}
2 changes: 2 additions & 0 deletions framework/core/src/User/Job/RequestPasswordResetJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class RequestPasswordResetJob extends AbstractJob

public function __construct(string $email)
{
parent::__construct();

$this->email = $email;
}

Expand Down

0 comments on commit 7fabbfb

Please sign in to comment.