summaryrefslogtreecommitdiff
path: root/lib/Travelynx
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-12-30 16:27:51 +0100
committerDaniel Friesel <derf@finalrewind.org>2022-12-30 16:27:51 +0100
commit59f844103dcab9de9e8c29941157bf1257cef5a6 (patch)
tree34b6704bfe58c6d230ea111bc09571e6329ec2f1 /lib/Travelynx
parentccc93413a28d03fd3d2ccf2d86831ad00c77cfe2 (diff)
worker: optionally publish influxdb stats
Diffstat (limited to 'lib/Travelynx')
-rw-r--r--lib/Travelynx/Command/work.pm12
1 files changed, 12 insertions, 0 deletions
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;