Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nil dereference #1330

Merged
merged 2 commits into from
Sep 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions admin/command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ func (r *CommandRunner) runAdminServer(ctx context.Context) error {

func (r *CommandRunner) processLoop(ctx context.Context) {
defer func() {
r.logger.Info().Msg("process loop shutting down")

// cleanup uncompleted requests from the command queue
for command := range r.commandQ {
close(command.responseChan)
Expand All @@ -266,7 +268,11 @@ func (r *CommandRunner) processLoop(ctx context.Context) {

for {
select {
case command := <-r.commandQ:
case command, ok := <-r.commandQ:
if !ok {
return
}

r.logger.Info().Str("command", command.command).Msg("received new command")

var err error
Expand Down Expand Up @@ -299,7 +305,6 @@ func (r *CommandRunner) processLoop(ctx context.Context) {
command.responseChan <- &CommandResponse{err}
close(command.responseChan)
case <-ctx.Done():
r.logger.Info().Msg("process loop shutting down")
return
}
}
Expand Down