Documentation ¶
Overview ¶
Package gracequit handle delete pid file at dead, set logging path and folder, setup http/pprof service and etc. common tasks for background service.
Example:
ctx := gracequit.New( myPathPid, 2, ).Init()
...
for { select { case <-ctx.Done(): { return } case <-time.After(d): { // err := myOtherJob(...) gutil.CheckErr(err) } } }
Index ¶
Constants ¶
View Source
const (
// DefaultQuitAfterSecs quit main process after n seconds
DefaultQuitAfterSecs = 2
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GraceQuit ¶
type GraceQuit struct {
// contains filtered or unexported fields
}
GraceQuit internal struct holds settings
func (*GraceQuit) GetContext ¶
GetContext use context.Context share states.
Click to show internal directories.
Click to hide internal directories.