Closed mtlynch closed 8 years ago
This fixes issue #43
but just for clarity, what's the specific messiness that bothers you? How we're checking if the server is serving?
Review status: 0 of 2 files reviewed at latest revision, all discussions resolved.
Comments from Reviewable
but just for clarity, what's the specific messiness that bothers you? How we're checking if the server is serving?
Yeah, it just feels very ugly that we have to make real HTTP requests to a different port just to make sure the server we started is active. I wish that there was like a thread-safe "is_serving" attribute on the mlab-ns server. For mitmdump
I'm a little less embarrassed because we're starting it in a subprocess so there's not much programmatic access we can expect, but I'd still be open to a better solution there.
Review status: 0 of 2 files reviewed at latest revision, all discussions resolved.
Comments from Reviewable
The ReplayHTTPServer had an issue in that when it started up, it wouldn't necessarily be serving HTTP requests yet because it started the actual servers in background threads. This change explicitly waits until the background threads are actually serving HTTP requests before returning.
Note: This is an uglier and more convoluted solution than I want, but it's the best thing I can think of. I'm open to other solutions that eliminate this race condition.
This change is