From 291e46bb1a1f7eae3721a6ddae20678c2386cf1c Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 11 Jan 2023 10:07:29 +0000 Subject: [PATCH] Attempt to fix CI specific failure. --- test/lib/cpp/02-subscribe-qos1-async2.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/lib/cpp/02-subscribe-qos1-async2.cpp b/test/lib/cpp/02-subscribe-qos1-async2.cpp index 98e2ea88..17da80be 100644 --- a/test/lib/cpp/02-subscribe-qos1-async2.cpp +++ b/test/lib/cpp/02-subscribe-qos1-async2.cpp @@ -51,6 +51,7 @@ int main(int argc, char *argv[]) { struct mosquittopp_test *mosq; int rc; + struct timespec tv = { 0, (long)100e6 }; assert(argc == 2); int port = atoi(argv[1]); @@ -59,6 +60,9 @@ int main(int argc, char *argv[]) mosq = new mosquittopp_test("subscribe-qos1-test"); + /* Help with possible race condition on CI */ + nanosleep(&tv, NULL); + rc = mosq->connect_async("localhost", port, 60, NULL); if(rc){ printf("connect_async failed: %s\n", mosquitto_strerror(rc)); @@ -72,7 +76,7 @@ int main(int argc, char *argv[]) } /* 50 millis to be system polite */ - struct timespec tv = { 0, (long)50e6 }; + tv.tv_nsec = (long)50e6; while(should_run){ nanosleep(&tv, NULL); }