Race conditions when first connecting to the bus
pjf opened this issue · 1 comments
pjf commented
From #52, there appears to be a condition where we can try to send things across the bus before it's fully connected. This is definitely something which can happen with ZMQ, and may be seen with something like:
use Exobrain;
my $exobrain = Exobrain->new;
$exobrain->notify("Hello World 1");
sleep(1);
$exobrain->notify("Hello World 2");
Solutions could be:
- Provide a
$exobrain->connect
or equivalent message to make sure we're actually connected to the bus. We'd need to say if we're going to be subscribing or publishing; so it may make sense to just call$exobrain->sub
or $exobrain->pub` (which already exist, and will initiate the connection). - Actually be able to mark packets as important (eg, with intents), or configure a basic buffer that needs to fill before they get dropped (which is probably sufficient). I know that ZMQ has a way of specifying buffer sizes, although I have no idea if they exist on PUB sockets. This could just be a Simple Matter Of Code.
This ticket may also be a duplicate of #52 if this is the actual cause. (It may not be).
Many thanks to @techman83 in helping find this.