diff --git a/go.mod b/go.mod index ca15b62e2..5d7bc8cde 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/jmoiron/sqlx v1.4.0 github.com/lib/pq v1.10.9 github.com/nyaruka/ezconf v0.3.0 - github.com/nyaruka/gocommon v1.60.4 + github.com/nyaruka/gocommon v1.60.5 github.com/nyaruka/goflow v0.226.0 github.com/nyaruka/null/v3 v3.0.0 github.com/nyaruka/redisx v0.8.1 diff --git a/go.sum b/go.sum index 29bf126cb..1a85f6483 100644 --- a/go.sum +++ b/go.sum @@ -224,8 +224,8 @@ github.com/naoina/toml v0.1.1 h1:PT/lllxVVN0gzzSqSlHEmP8MJB4MY2U7STGxiouV4X8= github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nyaruka/ezconf v0.3.0 h1:kGvJqVN8AHowb4HdaHAviJ0Z3yI5Pyekp1WqibFEaGk= github.com/nyaruka/ezconf v0.3.0/go.mod h1:89GUW6EPRNLIxT7lC4LWnjWTgZeQwRoX7lBmc8ralAU= -github.com/nyaruka/gocommon v1.60.4 h1:QpnSJailgaXpfjFjjuKTy/4NufgfmGfdFGib8khXm9o= -github.com/nyaruka/gocommon v1.60.4/go.mod h1:kFJuOq8COneV7ssfK6xgCMJ8gP8fQifLQnNXBnE4YL0= +github.com/nyaruka/gocommon v1.60.5 h1:V10rosGzVArRspilfbi65TyHBZzjLQbwmaBeicr2Drw= +github.com/nyaruka/gocommon v1.60.5/go.mod h1:kFJuOq8COneV7ssfK6xgCMJ8gP8fQifLQnNXBnE4YL0= github.com/nyaruka/goflow v0.226.0 h1:mVJBy1ojDSWdnPx/Y/YPflcKIMgmXjM3oC6VVCRTBo4= github.com/nyaruka/goflow v0.226.0/go.mod h1:spXtSWgS7dusHIfUFCvJGjSMc7d4FX9Abl6S7tg49ks= github.com/nyaruka/null/v2 v2.0.3 h1:rdmMRQyVzrOF3Jff/gpU/7BDR9mQX0lcLl4yImsA3kw= diff --git a/mailroom.go b/mailroom.go index 68344332c..65b9cc500 100644 --- a/mailroom.go +++ b/mailroom.go @@ -140,7 +140,7 @@ func (mr *Mailroom) Start() error { log.Info("cloudwatch ok") } - mr.rt.CW.StartQueue(mr.wg, time.Second*3) + mr.rt.CW.StartQueue(time.Second * 3) // init our foremen and start it mr.handlerForeman.Start() @@ -167,16 +167,16 @@ func (mr *Mailroom) Stop() error { mr.batchForeman.Stop() mr.throttledForeman.Stop() - mr.rt.CW.StopQueue() - - close(mr.quit) + close(mr.quit) // tell workers and crons to stop mr.cancel() - // stop our web server mr.webserver.Stop() mr.wg.Wait() + // now that all tasks are finished, stop services they depend on + mr.rt.CW.StopQueue() + log.Info("mailroom stopped") return nil }