From 59f844103dcab9de9e8c29941157bf1257cef5a6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Dec 2022 16:27:51 +0100 Subject: worker: optionally publish influxdb stats --- lib/Travelynx/Command/work.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/Travelynx') diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm index e12e5e3..6010fb5 100644 --- a/lib/Travelynx/Command/work.pm +++ b/lib/Travelynx/Command/work.pm @@ -249,6 +249,18 @@ sub run { } )->wait; } + + my $started_at = $now; + $now = DateTime->now( time_zone => 'Europe/Berlin' ); + + my $worker_duration = $now->epoch - $started_at->epoch; + + if ( $self->app->config->{influxdb}->{url} ) { + $self->app->ua->post_p( + $self->app->config->{influxdb}->{url}, + "worker duration_seconds=$worker_duration" + )->wait; + } } 1; -- cgit v1.2.3