Skip to content

Unnecessary check in gracefulShutdown #2884

@mojixcoder

Description

@mojixcoder

In StartConfig.start:

if sc.GracefulTimeout >= 0 {
	gCtx, cancel := stdContext.WithCancel(ctx) // end goroutine when Serve returns early
	defer cancel()
	go gracefulShutdown(gCtx, &sc, &server, logger)
}

and inside gracefulShutdown method:

timeout := sc.GracefulTimeout
if timeout == 0 {
	timeout = 10 * time.Second
}

this timeout == 0 never reaches since it is checked before, we should either remove sc.GracefulTimeout >= 0 or if timeout == 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions