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

Shutdown tolerance time #196

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mailroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,12 @@ func (mr *Mailroom) Stop() error {
mr.batchForeman.Stop()
mr.handlerForeman.Stop()
mr.flowBatchForeman.Stop()
librato.Stop()
close(mr.quit)
mr.cancel()

time.Sleep(time.Second * time.Duration(mr.rt.Config.ShutdownToleranceTime))

librato.Stop()
// stop our web server
mr.webserver.Stop()

Expand Down
4 changes: 4 additions & 0 deletions runtime/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ type Config struct {

WhatsappSystemUserToken string `help:"WhatsApp system user token"`
MetaWebhookURL string `help:"Meta webhook URL"`

ShutdownToleranceTime int `help:"Shutdown tolerance time(in seconds)"`
}

// NewDefaultConfig returns a new default configuration object
Expand Down Expand Up @@ -163,6 +165,8 @@ func NewDefaultConfig() *Config {

WhatsappSystemUserToken: "",
MetaWebhookURL: "https://graph.facebook.com/v21.0",

ShutdownToleranceTime: 10,
}
}

Expand Down
Loading