SNEWS2 / SNEWS_Publishing_Tools

Publishing Tool for SNEWS
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

fix test-connection #65

Closed KaraMelih closed 1 year ago

KaraMelih commented 1 year ago

This fixes the test-connection command that gets stuck when there is no connection established.

If the no-firedrill broker is running, you would get a confirmation e.g.; test_connection(detector_name="XENONnT", firedrill=False)
results

> Testing your connection to kafka://kafka.scimma.org/snews.experiments-test. 
> Should take ~10 seconds...

You (XENONnT) have a connection to the server at 2023-02-23T12:53:25.598600

When you try firedrill broker which is not running, you shouldn't have connection, and this test_connection(detector_name="XENONnT", firedrill=True)
results

> Testing your connection to kafka://kafka.scimma.org/snews.experiments-firedrill. 
> Should take ~10 seconds...
    Couldn't get a confirmation in 10 sec. 
    Maybe increase timeout and try again.

immediately. Before the fix, the while-time loop was not invoked since the subscription was persistent (similar to alert subscriptions) so it was not ending before it finds the connection or manually killed. Now, the subscription is no longer persistent, it looks for the last few messages and exits.

joesmolsky commented 1 year ago

Looks good to me.