Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed May 23, 2024
1 parent 03dd771 commit 4ca67fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
10 changes: 4 additions & 6 deletions src/Queue/Jobs/StompJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Illuminate\Queue\Jobs\JobName;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use Psr\Log\LoggerInterface;
use Stomp\Transport\Frame;
Expand Down Expand Up @@ -113,6 +112,7 @@ public function fire()
protected function isNativeLaravelJob(): bool
{
$job = Arr::get($this->payload, 'job');

return $job && str_contains($job, 'CallQueuedHandler@call');
}

Expand Down Expand Up @@ -183,9 +183,9 @@ protected function getSubscriptionName(): string
public function delete()
{
$this->log->info("$this->session [STOMP] Deleting a message from queue: " . print_r([
'queue' => $this->queue,
'message' => $this->frame,
], true));
'queue' => $this->queue,
'message' => $this->frame,
], true));

parent::delete();
}
Expand All @@ -204,7 +204,6 @@ public function release($delay = 0)
$payload = $this->createStompPayload($delay);
$this->stompQueue->pushRaw($payload, $this->queue, []);
}

}

protected function createStompPayload(int $delay): Message
Expand Down Expand Up @@ -260,5 +259,4 @@ protected function failed($e)
$this->log->error('Exception in job failing: ' . $e->getMessage());
}
}

}
14 changes: 7 additions & 7 deletions src/Queue/StompQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ protected function writeToMultipleQueues(array $writeQueues, Message $payload):
* @var $payload Message
*/
$this->log->info("$this->session [STOMP] Pushing stomp payload to queue: " . print_r([
'body' => $payload->getBody(),
'headers' => $payload->getHeaders(),
'queue' => $writeQueues,
], true));
'body' => $payload->getBody(),
'headers' => $payload->getHeaders(),
'queue' => $writeQueues,
], true));

$allEventsSent = true;

Expand All @@ -238,7 +238,7 @@ protected function writeToMultipleQueues(array $writeQueues, Message $payload):
return $allEventsSent;
}

protected function write($queue, Message $payload, $tryAgain=true): bool
protected function write($queue, Message $payload, $tryAgain = true): bool
{
// This will write all the events received in a single batch, then send disconnect frame
try {

Check failure on line 244 in src/Queue/StompQueue.php

View workflow job for this annotation

GitHub Actions / build

Method Asseco\Stomp\Queue\StompQueue::write() should return bool but return statement is missing.
Expand All @@ -253,9 +253,9 @@ protected function write($queue, Message $payload, $tryAgain=true): bool

if ($tryAgain) {
$this->log->info("$this->session [STOMP] Trying to send again...");

return $this->write($queue, $payload, false);
}

}
}

Expand Down Expand Up @@ -468,6 +468,7 @@ protected function reconnect(bool $subscribe = true)
}

$this->log->error("$this->session [STOMP] Circuit breaker executed after {$this->circuitBreaker} tries, exiting.");

return;
}

Expand Down Expand Up @@ -531,5 +532,4 @@ public function ackLastFrameIfNecessary()
$this->_lastFrame = null;
}
}

}
1 change: 1 addition & 0 deletions src/StompServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function boot()

app()->singleton('stompLog', function ($app) use ($logsEnabled) {
$logManager = config('asseco-stomp.log_manager');

return $logsEnabled ? new $logManager($app) : new NullLogger();
});
}
Expand Down

0 comments on commit 4ca67fe

Please sign in to comment.