From 40fa42fec405643d5ad9c829aff6f92131fcf725 Mon Sep 17 00:00:00 2001 From: Thomas O'Rourke Date: Thu, 7 Jan 2016 10:44:03 +0200 Subject: [PATCH] supervisor-and-application race condition - there is no way to handle in this chapter so a sleep (hack) is used and with a note --- getting-started/mix-otp/supervisor-and-application.markdown | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/getting-started/mix-otp/supervisor-and-application.markdown b/getting-started/mix-otp/supervisor-and-application.markdown index 0a26c878d..58e037086 100644 --- a/getting-started/mix-otp/supervisor-and-application.markdown +++ b/getting-started/mix-otp/supervisor-and-application.markdown @@ -236,8 +236,10 @@ In other words, we want the registry to keep on running even if a bucket crashes # Stop the bucket with non-normal reason Process.exit(bucket, :shutdown) - # Do a sync to ensure the registry processed the down message - _ = KV.Registry.create(registry, "bogus") + # The :DOWN message is handled asynchronously, so we don't know if it has been handled yet, so give it a chance to run... + # We will fix this race condition in the next chapter + :timer.sleep(100) + assert KV.Registry.lookup(registry, "shopping") == :error end ```