22# SPDX-License-Identifier: GPL-2.0-or-later
33
44package OpenQA::WebAPI::Plugin::ObsRsync::Task ;
5- use Mojo::Base ' Mojolicious::Plugin' ;
5+ use Mojo::Base ' Mojolicious::Plugin' , -signatures ;
66use Mojo::File;
77use IPC::Run;
88use Feature::Compat::Try;
99
10- sub register {
11- my ($self , $app ) = @_ ;
10+ sub register ($self , $app , $conf ) {
1211 $app -> minion-> add_task(obs_rsync_run => \&run);
1312 $app -> minion-> add_task(obs_rsync_update_dirty_status => \&update_dirty_status);
1413 $app -> minion-> add_task(obs_rsync_update_builds_text => \&update_obs_builds_text);
1514}
1615
17- sub _retry_or_finish {
18- my ($job , $helper , $project , $retry_interval , $retry_max_count ) = @_ ;
16+ sub _retry_or_finish ($job , $helper , $project = undef , $retry_interval = undef , $retry_max_count = undef ) {
1917 $retry_interval ||= $helper -> retry_interval;
2018 $retry_max_count ||= $helper -> retry_max_count;
2119
@@ -34,9 +32,7 @@ sub _retry_or_finish {
3432# a retry but is otherwise not concerned with any details (such as invoking rsync or creating openQA jobs).
3533# Jobs of this task are enqueued by the "/obs_rsync/#project/runs" route (POST request) which can be triggered via the
3634# "Sync now" button on the web UI (e.g. on a page like "/admin/obs_rsync/openSUSE:Factory:Staging:C").
37- sub run {
38- my ($job , $args ) = @_ ;
39-
35+ sub run ($job , $args ) {
4036 my $app = $job -> app;
4137 my $project = $args -> {project };
4238 my $helper = $app -> obs_rsync;
@@ -79,19 +75,15 @@ sub run {
7975 return $job -> finish({code => $exit_code , message => $error });
8076}
8177
82- sub update_dirty_status {
83- my ($job , $args ) = @_ ;
84-
78+ sub update_dirty_status ($job , $args ) {
8579 my $app = $job -> app;
8680 my $project = $args -> {project };
8781 my $helper = $app -> obs_rsync;
8882 eval { $helper -> is_status_dirty($project , 1); 1 };
8983 return $job -> finish(0);
9084}
9185
92- sub update_obs_builds_text {
93- my ($job , $args ) = @_ ;
94-
86+ sub update_obs_builds_text ($job , $args ) {
9587 my $app = $job -> app;
9688 my $alias = $args -> {alias };
9789 my $helper = $app -> obs_rsync;
0 commit comments