diff --git a/cmd/bots/discord/discord.go b/cmd/bots/discord/discord.go index ee511146..296c4fc8 100644 --- a/cmd/bots/discord/discord.go +++ b/cmd/bots/discord/discord.go @@ -157,12 +157,16 @@ func runDiscordBot() error { }() <-ctx.Done() + waitScheduler(taskScheduler, logger) + logger.Info("Discord bot finished") + return nil +} + +func waitScheduler(taskScheduler chrono.TaskScheduler, logger *zap.Logger) { if !taskScheduler.IsShutdown() { <-taskScheduler.Shutdown() logger.Info("Task scheduler has been shutdown successfully") } - logger.Info("Discord bot finished") - return nil } func runMessagingClients(