Skip to content

Commit eaf2e6a

Browse files
authored
Merge pull request #358 from bowphp/refactor/code-base
Refactoring queue adapter and add redis support
2 parents e802458 + 845e544 commit eaf2e6a

17 files changed

Lines changed: 1126 additions & 276 deletions

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
image: mysql:8.3.0
1919
restart: unless-stopped
2020
ports:
21-
- "3308:3306"
21+
- "3306:3306"
2222
environment:
2323
MYSQL_DATABASE: test_db
2424
MYSQL_ROOT_PASSWORD: password
@@ -73,7 +73,7 @@ services:
7373
restart: unless-stopped
7474
ports:
7575
- "1025:1025"
76-
- "1080:8025"
76+
- "1080:1080"
7777
networks:
7878
- bowphp_network
7979
healthcheck:

src/Http/Client/Response.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ public function isSuccessful(): bool
133133
/**
134134
* Get the response executing time
135135
*
136-
* @return ?int
136+
* @return mixed
137137
*/
138-
public function getExecutionTime(): ?int
138+
public function getExecutionTime(): mixed
139139
{
140140
return $this->headers['total_time'] ?? null;
141141
}

src/Mail/MailQueueTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ public function process(): void
6060
*/
6161
public function onException(Throwable $e): void
6262
{
63-
$this->deleteJob();
63+
$this->deleteTask();
6464
}
6565
}

src/Notifier/Adapters/TelegramChannelAdapter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TelegramChannelAdapter implements ChannelAdapterInterface
1515
/**
1616
* @var string
1717
*/
18-
private string $botToken;
18+
private ?string $botToken;
1919

2020
/**
2121
* Constructor
@@ -25,10 +25,6 @@ class TelegramChannelAdapter implements ChannelAdapterInterface
2525
public function __construct()
2626
{
2727
$this->botToken = config('messaging.telegram.bot_token');
28-
29-
if (!$this->botToken) {
30-
throw new InvalidArgumentException('The Telegram bot token is required');
31-
}
3228
}
3329

3430
/**
@@ -51,6 +47,10 @@ public function send(Model $context, Notifier $notifier): void
5147
throw new InvalidArgumentException('The chat ID and message are required for Telegram');
5248
}
5349

50+
if (!$this->botToken) {
51+
throw new InvalidArgumentException('The Telegram bot token is required');
52+
}
53+
5454
$client = new HttpClient();
5555
$endpoint = "https://api.telegram.org/bot{$this->botToken}/sendMessage";
5656

src/Notifier/NotifierQueueTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ public function process(): void
5252
*/
5353
public function onException(Throwable $e): void
5454
{
55-
$this->deleteJob();
55+
$this->deleteTask();
5656
}
5757
}

src/Notifier/NotifierShouldQueue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
interface NotifierShouldQueue
66
{
7-
}
7+
}

0 commit comments

Comments
 (0)