From 8ec8da0491ad89604700b3e29a227966f6d84ba1 Mon Sep 17 00:00:00 2001 From: Perl Tidy Date: Wed, 5 Dec 2018 15:38:52 -0500 Subject: no bug - reformat all the code using the new perltidy rules --- extensions/Push/lib/BacklogMessage.pm | 135 +++++++++++++++++----------------- 1 file changed, 69 insertions(+), 66 deletions(-) (limited to 'extensions/Push/lib/BacklogMessage.pm') diff --git a/extensions/Push/lib/BacklogMessage.pm b/extensions/Push/lib/BacklogMessage.pm index 28b17bae3..942eb77eb 100644 --- a/extensions/Push/lib/BacklogMessage.pm +++ b/extensions/Push/lib/BacklogMessage.pm @@ -28,31 +28,31 @@ use Encode; # initialisation # -use constant DB_TABLE => 'push_backlog'; +use constant DB_TABLE => 'push_backlog'; use constant DB_COLUMNS => qw( - id - message_id - push_ts - payload - change_set - routing_key - connector - attempt_ts - attempts - last_error + id + message_id + push_ts + payload + change_set + routing_key + connector + attempt_ts + attempts + last_error ); use constant UPDATE_COLUMNS => qw( - attempt_ts - attempts - last_error + attempt_ts + attempts + last_error ); use constant LIST_ORDER => 'push_ts'; use constant VALIDATORS => { - payload => \&_check_payload, - change_set => \&_check_change_set, - routing_key => \&_check_routing_key, - connector => \&_check_connector, - attempts => \&_check_attempts, + payload => \&_check_payload, + change_set => \&_check_change_set, + routing_key => \&_check_routing_key, + connector => \&_check_connector, + attempts => \&_check_attempts, }; # @@ -60,46 +60,46 @@ use constant VALIDATORS => { # sub create_from_message { - my ($class, $message, $connector) = @_; - my $self = $class->create({ - message_id => $message->id, - push_ts => $message->push_ts, - payload => $message->payload, - change_set => $message->change_set, - routing_key => $message->routing_key, - connector => $connector->name, - attempt_ts => undef, - attempts => 0, - last_error => undef, - }); - return $self; + my ($class, $message, $connector) = @_; + my $self = $class->create({ + message_id => $message->id, + push_ts => $message->push_ts, + payload => $message->payload, + change_set => $message->change_set, + routing_key => $message->routing_key, + connector => $connector->name, + attempt_ts => undef, + attempts => 0, + last_error => undef, + }); + return $self; } # # accessors # -sub message_id { return $_[0]->{'message_id'} } -sub push_ts { return $_[0]->{'push_ts'}; } -sub payload { return $_[0]->{'payload'}; } -sub change_set { return $_[0]->{'change_set'}; } +sub message_id { return $_[0]->{'message_id'} } +sub push_ts { return $_[0]->{'push_ts'}; } +sub payload { return $_[0]->{'payload'}; } +sub change_set { return $_[0]->{'change_set'}; } sub routing_key { return $_[0]->{'routing_key'}; } -sub connector { return $_[0]->{'connector'}; } -sub attempt_ts { return $_[0]->{'attempt_ts'}; } -sub attempts { return $_[0]->{'attempts'}; } -sub last_error { return $_[0]->{'last_error'}; } +sub connector { return $_[0]->{'connector'}; } +sub attempt_ts { return $_[0]->{'attempt_ts'}; } +sub attempts { return $_[0]->{'attempts'}; } +sub last_error { return $_[0]->{'last_error'}; } sub payload_decoded { - my ($self) = @_; - return from_json($self->{'payload'}); + my ($self) = @_; + return from_json($self->{'payload'}); } sub attempt_time { - my ($self) = @_; - if (!exists $self->{'attempt_time'}) { - $self->{'attempt_time'} = datetime_from($self->attempt_ts)->epoch; - } - return $self->{'attempt_time'}; + my ($self) = @_; + if (!exists $self->{'attempt_time'}) { + $self->{'attempt_time'} = datetime_from($self->attempt_ts)->epoch; + } + return $self->{'attempt_time'}; } # @@ -107,11 +107,11 @@ sub attempt_time { # sub inc_attempts { - my ($self, $error) = @_; - $self->{attempt_ts} = Bugzilla->dbh->selectrow_array('SELECT NOW()'); - $self->{attempts} = $self->{attempts} + 1; - $self->{last_error} = $error; - $self->update; + my ($self, $error) = @_; + $self->{attempt_ts} = Bugzilla->dbh->selectrow_array('SELECT NOW()'); + $self->{attempts} = $self->{attempts} + 1; + $self->{last_error} = $error; + $self->update; } # @@ -119,32 +119,35 @@ sub inc_attempts { # sub _check_payload { - my ($invocant, $value) = @_; - length($value) || ThrowCodeError('push_invalid_payload'); - return $value; + my ($invocant, $value) = @_; + length($value) || ThrowCodeError('push_invalid_payload'); + return $value; } sub _check_change_set { - my ($invocant, $value) = @_; - (defined($value) && length($value)) || ThrowCodeError('push_invalid_change_set'); - return $value; + my ($invocant, $value) = @_; + (defined($value) && length($value)) + || ThrowCodeError('push_invalid_change_set'); + return $value; } sub _check_routing_key { - my ($invocant, $value) = @_; - (defined($value) && length($value)) || ThrowCodeError('push_invalid_routing_key'); - return $value; + my ($invocant, $value) = @_; + (defined($value) && length($value)) + || ThrowCodeError('push_invalid_routing_key'); + return $value; } sub _check_connector { - my ($invocant, $value) = @_; - Bugzilla->push_ext->connectors->exists($value) || ThrowCodeError('push_invalid_connector'); - return $value; + my ($invocant, $value) = @_; + Bugzilla->push_ext->connectors->exists($value) + || ThrowCodeError('push_invalid_connector'); + return $value; } sub _check_attempts { - my ($invocant, $value) = @_; - return $value || 0; + my ($invocant, $value) = @_; + return $value || 0; } 1; -- cgit v1.2.3-24-g4f1b