Skip to content

Commit

Permalink
Use signatures on WebSockets/Controller/Worker.pm
Browse files Browse the repository at this point in the history
Part of a small refactoring, and as per the openqa intention to move to
signatures prototype.
  • Loading branch information
b10n1k committed Feb 28, 2025
1 parent 68efd8d commit 191b00b
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions lib/OpenQA/WebSockets/Controller/Worker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later

package OpenQA::WebSockets::Controller::Worker;
use Mojo::Base 'Mojolicious::Controller';
use Mojo::Base 'Mojolicious::Controller', -signatures;

use DBIx::Class::Timestamps 'now';
use OpenQA::Schema;
Expand All @@ -18,8 +18,7 @@ use Mojo::Util 'dumper';

use constant LOG_WORKER_STATUS_MESSAGES => $ENV{OPENQA_LOG_WORKER_STATUS_MESSAGES} // 0;

sub ws {
my ($self) = @_;
sub ws ($self) {
my $status = $self->status;

# add worker connection
Expand All @@ -34,8 +33,7 @@ sub ws {
$self->tx->max_websocket_size(10485760);
}

sub _finish {
my ($self, $code, $reason) = @_;
sub _finish ($self, $code, $reason) {
return undef unless $self;

my $worker = OpenQA::WebSockets::Model::Status->singleton->remove_worker_connection($self->tx);
Expand All @@ -51,9 +49,7 @@ sub _finish {
# is lost unexpectedly. It will be considered offline after the configured timeout expires.
}

sub _message {
my ($self, $json) = @_;

sub _message ($self, $json) {
my $app = $self->app;
my $schema = $app->schema;
my $tx = $self->tx;
Expand Down Expand Up @@ -201,9 +197,8 @@ sub _message {
}
}

sub _check_assignment_process() {
my ($self, $worker, $current_job_id, $worker_id, $job_id, $job_token, $worker_previously_idle) = @_;

sub _check_assignment_process($self, $worker, $current_job_id, $worker_id, $job_id, $job_token, $worker_previously_idle)
{
return undef unless $worker;

my $registered_job_token;
Expand Down

0 comments on commit 191b00b

Please sign in to comment.