Skip to content

Commit 6c6bc00

Browse files
committed
ctx refactor
1 parent e4c7257 commit 6c6bc00

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

nsqd/channel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (c *Channel) StartDraining() {
160160
depth := c.Depth()
161161
inFlight := int64(c.InFlightCount())
162162
deferred := int64(c.DeferredCount())
163-
c.ctx.nsqd.logf(LOG_INFO, "CHANNEL(%s): draining depth:%d inFlight:%d deferred:%d", c.name, depth, inFlight, deferred)
163+
c.nsqd.logf(LOG_INFO, "CHANNEL(%s): draining depth:%d inFlight:%d deferred:%d", c.name, depth, inFlight, deferred)
164164
// if we are empty delete
165165
if depth+inFlight+deferred == 0 {
166166
go c.Delete()

nsqd/http.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ func (s *httpServer) doPauseTopic(w http.ResponseWriter, req *http.Request, ps h
408408
func (s *httpServer) doDrainTopic(w http.ResponseWriter, req *http.Request, ps httprouter.Params) (interface{}, error) {
409409
reqParams, err := http_api.NewReqParams(req)
410410
if err != nil {
411-
s.ctx.nsqd.logf(LOG_ERROR, "failed to parse request params - %s", err)
411+
s.nsqd.logf(LOG_ERROR, "failed to parse request params - %s", err)
412412
return nil, http_api.Err{400, "INVALID_REQUEST"}
413413
}
414414

@@ -417,14 +417,14 @@ func (s *httpServer) doDrainTopic(w http.ResponseWriter, req *http.Request, ps h
417417
return nil, http_api.Err{400, "MISSING_ARG_TOPIC"}
418418
}
419419

420-
topic, err := s.ctx.nsqd.GetExistingTopic(topicName)
420+
topic, err := s.nsqd.GetExistingTopic(topicName)
421421
if err != nil {
422422
return nil, http_api.Err{404, "TOPIC_NOT_FOUND"}
423423
}
424424

425425
err = topic.StartDraining()
426426
if err != nil {
427-
s.ctx.nsqd.logf(LOG_ERROR, "failure in %s - %s", req.URL.Path, err)
427+
s.nsqd.logf(LOG_ERROR, "failure in %s - %s", req.URL.Path, err)
428428
return nil, http_api.Err{500, "INTERNAL_ERROR"}
429429
}
430430
return nil, nil
@@ -775,7 +775,7 @@ func getOptByCfgName(opts interface{}, name string) (interface{}, bool) {
775775
}
776776

777777
func (s *httpServer) startDraining(w http.ResponseWriter, req *http.Request, ps httprouter.Params) (interface{}, error) {
778-
err := s.ctx.nsqd.StartDraining()
778+
err := s.nsqd.StartDraining()
779779
if err != nil {
780780
return nil, http_api.Err{500, "TODO"}
781781
}

nsqd/topic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (t *Topic) StartDraining() error {
112112
atomic.StoreInt32(&t.isDraining, 1)
113113

114114
msgsLeft := int64(len(t.memoryMsgChan)) + t.backend.Depth()
115-
t.ctx.nsqd.logf(LOG_INFO, "TOPIC(%s): draining. topic depth:%d", t.name, msgsLeft)
115+
t.nsqd.logf(LOG_INFO, "TOPIC(%s): draining. topic depth:%d", t.name, msgsLeft)
116116

117117
// if no outstanding messages, start channel drain
118118
if msgsLeft == 0 {

0 commit comments

Comments
 (0)