Skip to content

Commit

Permalink
WebAPI::Controller::Running: Remove uncovered close_connection handler
Browse files Browse the repository at this point in the history
  • Loading branch information
okurz committed Jul 23, 2024
1 parent 468dc67 commit 11bab0e
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/OpenQA/Shared/Controller/Running.pm
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ sub streamtext ($self, $file_name, $start_hook = undef, $close_hook = undef) {
# Check for new lines from the logfile using recurring timer
# Setup utility function to close the connection if something goes wrong
my $timer_id;
my $close_connection = sub ($self) {
Mojo::IOLoop->remove($timer_id);
$close_hook->();
$self->finish;
close $log;
};
$timer_id = Mojo::IOLoop->recurring(
TEXT_STREAMING_INTERVAL() => sub (@) {
if (!$ino) {
Expand All @@ -126,10 +120,9 @@ sub streamtext ($self, $file_name, $start_hook = undef, $close_hook = undef) {
$size = -s $logfile;
}

# Zero tolerance for any shenanigans with the logfile, such as
# truncation, rotation, etc.
my @st = stat $logfile;
return $close_connection->() unless @st && $st[1] == $ino && $st[3] > 0 && $st[7] >= $size;
die "Zero tolerance for any shenanigans with the logfile, such as truncation, rotation, etc."
unless @st && $st[1] == $ino && $st[3] > 0 && $st[7] >= $size;

# If there's new data, read it all and send it out. Then
# seek to the current position to reset EOF.
Expand Down

0 comments on commit 11bab0e

Please sign in to comment.