Closed jnicklas closed 10 years ago
Sorry it's taken me so long to look at this. My initial concern is what's up with the Travis failures, but it looks incidental...
Maybe. I did have problems with hangs sometimes, but I thought I'd resolved everything. The main problem is that terminating the ZMQ context blocks until all sockets have been shut down. Celluloid::ZMQ.terminate should probably at least have a timeout so it doesn't hang indefinitely.
Well, this passes locally for me, and is certainly better than no specs at all... just kinda surprised it deadlocks on Travis consistently across all VMs. Perhaps it's due to some sort of resource contention?
Closes #28
Sorry, this pull request is a bit of a mess.
I added a few basic specs which just check the most basic funcionality in the gem. It also provides a nice base on which to write more. These are more integration than unit tests, but I think that's what's most helpful here at this point. We might want to add some unit tests for critical components as well at some point. This is all happy path too, I'd like to be able to simulate failure conditions, but I have no idea how to do this with zeromq.
Additionally I changed some stuff. Sorry ;) I made
context
not lazily initialize the ZMQ context, since this is not threadsafe, and potentially problematic if the user forgets to call Celluloid::ZMQ.init. Instead it'll throw an exception ifinit
hasn't been called.I also made a small tweak to the waker which shuts it down properly when the mailbox goes down. This is necessary so that terminating the context doesn't hang indefinitely.