diff --git a/api/http.go b/api/http.go index 56c2f4f..444baf9 100644 --- a/api/http.go +++ b/api/http.go @@ -63,6 +63,7 @@ func (h *Handler) log(w http.ResponseWriter, req *http.Request) { } } +// NewHandler new api http handler func NewHandler(config *types.Config, workloadManager *workload.Manager) *Handler { return &Handler{ config: config, diff --git a/manager/workload/log.go b/manager/workload/log.go index 24906f9..cb1ee80 100644 --- a/manager/workload/log.go +++ b/manager/workload/log.go @@ -37,7 +37,7 @@ func (l *logBroadcaster) subscribe(app string, buf *bufio.ReadWriter) { } ID := coreutils.RandomString(8) - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(context.TODO()) defer cancel() l.subscribers[app][ID] = &subscriber{buf, cancel} diff --git a/manager/workload/manager.go b/manager/workload/manager.go index 9a98327..2813ee4 100644 --- a/manager/workload/manager.go +++ b/manager/workload/manager.go @@ -118,6 +118,7 @@ func (m *Manager) Run(ctx context.Context) error { } } +// Subscribe subscribes logs func (m *Manager) Subscribe(app string, buf *bufio.ReadWriter) { m.logBroadcaster.subscribe(app, buf) }