Skip to content

Commit d7118ef

Browse files
committed
optimize code
1 parent 7c0d3de commit d7118ef

4 files changed

Lines changed: 6 additions & 23 deletions

File tree

runtime/logs/mix-2022-10-09.log

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Driver/RedisDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct($config = [])
4545
$this->timeout = 5;
4646
$this->retrySeconds = 10;
4747
$this->handleTimeout = 10;
48-
$this->channel = make(ChannelConfig::class, ['channel' => 'mix-queue']);
48+
$this->channel = make(ChannelConfig::class, ['channel' => $config['default']]);
4949
}
5050

5151
private function initRedis()

src/JobMessage.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ public function job(): JobInterface
5050

5151
public function attempts(): bool
5252
{
53-
return $this->job->getMaxAttempts() > $this->attempts++;
53+
if ($this->job->getMaxAttempts() > $this->attempts++) {
54+
return true;
55+
}
56+
return false;
5457
}
5558

5659
public function getAttempts(): int

src/Util/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static function instance(): \Monolog\Logger
2020
{
2121
if (!isset(self::$instance)) {
2222
$logger = new \Monolog\Logger('queue');
23-
$rotatingFileHandler = new RotatingFileHandler(__DIR__ . '/../../runtime/logs/mix.log', 7);
23+
$rotatingFileHandler = new RotatingFileHandler(dirname(__DIR__, 1) . '../../../../runtime/logs/queue.log', 7);
2424
$rotatingFileHandler->setFormatter(new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n", 'Y-m-d H:i:s.u'));
2525
$logger->pushHandler($rotatingFileHandler);
2626
$logger->pushHandler(new Logger());

0 commit comments

Comments
 (0)