Skip to content

Commit

Permalink
nsqd: fix testcase concurrency issue in pull request #575
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaost committed Apr 25, 2015
1 parent d4d006e commit c5b9fa0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nsqd/nsqd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c5b9fa0

Please sign in to comment.