From c5b9fa0dad45d842d765d42237c3f7b897a9ed93 Mon Sep 17 00:00:00 2001 From: xiaost Date: Sun, 26 Apr 2015 04:03:31 +0800 Subject: [PATCH] nsqd: fix testcase concurrency issue in pull request #575 detail: https://travis-ci.org/bitly/nsq/jobs/60022415 --- nsqd/nsqd_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nsqd/nsqd_test.go b/nsqd/nsqd_test.go index 46df4f5e4..aeb9124e5 100644 --- a/nsqd/nsqd_test.go +++ b/nsqd/nsqd_test.go @@ -242,9 +242,13 @@ func TestPauseMetadata(t *testing.T) { _, _, nsqd := mustStartNSQD(opts) defer nsqd.Exit() + // avoid concurrency issue of async PersistMetadata() calls + nsqd.setFlag(flagLoading, true) topicName := "pause_metadata" + strconv.Itoa(int(time.Now().Unix())) topic := nsqd.GetTopic(topicName) channel := topic.GetChannel("ch") + nsqd.setFlag(flagLoading, false) + nsqd.PersistMetadata() b, _ := metadataForChannel(nsqd, 0, 0).Get("paused").Bool() equal(t, b, false)