summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-11-05 13:42:05 +0100
committerDaniel Friesel <derf@finalrewind.org>2017-11-05 13:42:05 +0100
commit585c099f0f554905e720ce558bb1c6343847542b (patch)
tree1fe554996810a462a0cbb27592b626ec1f7a7d00 /bin
parent6026d464222f6f51dbb0488ea94a6ab6c79f1f87 (diff)
document sleep workaround
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mqtt-multipub11
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