bIgBV/tokio-beanstalkd

Errors around spawning beanstalkd in the tests

birkenfeld opened this issue · 1 comments

Watching Jon's stream, I wondered about the unsafe manipulation of the SPAWNED atomic seen here.

The whole point of atomics is to mutate them without being mut, so having a static mut one is very strange. You should be able to implement spawn_beanstalkd with a single compare_and_swap (it returns the old value).

Further, in the stream it looked like there are a couple other problems:

  • once running, the process isn't shut down anymore. Might have been introduced by the refactor though...
  • when running concurrently, one of the tests sometimes failed. Reason is possibly that the connect() comes before the spawned beanstalkd is accepting connections?
bIgBV commented

When I wrote this I was pretty inexperienced with both rust and unsafe, so it definitely isn't the best way to use those tools.

I just merged in #15 which changes the tests so that they rely on the system's beanstalkd service, as that is a more maintainable solution. I'm going to close this issue, as the last PR solves this problem.