Skip to content

Commit

Permalink
Merge pull request #93 from jehiah/no_topic_response_93
Browse files Browse the repository at this point in the history
nsqd: change response for no topics from nsqd
  • Loading branch information
mreiferson committed Nov 6, 2012
2 parents 8ec7c3c + 00894cc commit b54f965
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions nsqd/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,20 +280,15 @@ func statsHandler(w http.ResponseWriter, req *http.Request) {

stats := nsqd.getStats()

if len(stats) == 0 {
if jsonFormat {
util.ApiResponse(w, 500, "NO_TOPICS", nil)
} else {
io.WriteString(w, "\nNO_TOPICS\n")
}
return
}

if jsonFormat {
util.ApiResponse(w, 200, "OK", struct {
Topics []TopicStats `json:"topics"`
}{stats})
} else {
if len(stats) == 0 {
io.WriteString(w, "\nNO_TOPICS\n")
return
}
for _, t := range stats {
io.WriteString(w, fmt.Sprintf("\n[%-15s] depth: %-5d be-depth: %-5d msgs: %-8d\n",
t.TopicName,
Expand Down

0 comments on commit b54f965

Please sign in to comment.