...

Package process

import "github.com/Diarkis/diarkis/process"
Overview
Index

Overview ▾

func GetShutdownTimeout

func GetShutdownTimeout() int64

GetShutdownTimeout returns the server process shutdown timeout in seconds.

[IMPORTANT] Default is 10 seconds.
[IMPORTANT] If DIARKIS_SHUTDOWN_TIMEOUT env is given, shutdown timeout changes.

func IsRunning

func IsRunning() bool

IsRunning returns true if the process is running

func IsTerminating

func IsTerminating() bool

IsTerminating returns true when the process is in termination mode after invoking Stop

func OnSIGHUP

func OnSIGHUP(callback func())

OnSIGHUP Registers a callback function on SIGHUP signal

func OnSIGUSR1

func OnSIGUSR1(callback func())

OnSIGUSR1 Registers a callback function on SIGUSR1 signal

func OnSIGUSR2

func OnSIGUSR2(callback func())

OnSIGUSR2 Registers a callback function on SIGUSR2 signal

func OnStart

func OnStart(task func())

OnStart Registers a callback on process start to be executed BEFORE the process is ready

func OnStop

func OnStop(cb func(ctx context.Context, done func(error)))

OnStop registers a callback on process stop to be executed BEFORE termination tasks are executed

func OnTerminate

func OnTerminate(task func(ctx context.Context, next func(error)))

OnTerminate Registers a callback on process stop to be executed BEFORE the process termination

func Start

func Start()

Start Starts the process

func Stop

func Stop()

Stop Stops the process with exit code 0

func StopWithError

func StopWithError(err error)

StopWithError Stops the process with an error and exit code 1