HDF5Writer_Socket: wait for the subscription before the first file is announced

The test connected its SUB socket and wrote at once; file 1 is closed and
announced on the PUB socket right after the second image, and PUB drops
whatever it sends before the subscription has reached it (slow joiner). On a
loaded CI runner the first notification was lost and the test read file 2
where it expected file 1. Wait 2 s after subscribing, as the preview and
metadata socket tests already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXc1zD1yxHqaR1DGdCTHL4
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-10-17 09:06:54 +02:00
1 parent 234774ff09
commit 38e75c8e5b
1 file changed
+5
+5
View File
@@ -5,6 +5,7 @@
#include <iostream>
#include <fstream>
#include <filesystem>
#include <thread>
#include "../common/DiffractionExperiment.h"
#include "../writer/HDF5Objects.h"
@@ -573,6 +574,10 @@ TEST_CASE("HDF5Writer_Socket", "[HDF5][Full]") {
s.SubscribeAll();
s.ReceiveTimeout(std::chrono::seconds(5));
// PUB drops what it sends before the subscription has reached it, and the first file is closed
// (and announced) right after the second image - ensure sub socket is properly connected
std::this_thread::sleep_for(std::chrono::seconds(2));
for (int i = 0; i < x.GetImageNum(); i++) {
DataMessage message{};
message.image = CompressedImage(image, x.GetXPixelsNum(), x.GetYPixelsNum());