diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-11-05 13:42:05 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-11-05 13:42:05 +0100 |
commit | 585c099f0f554905e720ce558bb1c6343847542b (patch) | |
tree | 1fe554996810a462a0cbb27592b626ec1f7a7d00 | |
parent | 6026d464222f6f51dbb0488ea94a6ab6c79f1f87 (diff) |
document sleep workaround
-rwxr-xr-x | bin/mqtt-multipub | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/mqtt-multipub b/bin/mqtt-multipub index 0502b20..40eba91 100755 --- a/bin/mqtt-multipub +++ b/bin/mqtt-multipub @@ -9,6 +9,7 @@ our $VERSION = '0.00'; use File::Slurp qw(read_file); use Getopt::Long; use Net::MQTT::Simple; +use Time::HiRes qw(usleep); my $mqtt_host; @@ -53,6 +54,16 @@ for my $arg (@ARGV) { } } +# XXX Net::MQTT::Simple passes data to the socket layer, but does not wait for +# it to be successfully sent. So (especially on fast systems, e.g. modern +# Core i5/i7 CPUs) we might terminate before all data was transmitted, leading +# to loss of some messages. +# +# Fixing this probably requires a dive into Net::MQTT::Simple and possibly +# changes in its API, so let's dance the workaround dance for now. + +usleep(100_000); + __END__ =head1 NAME |