From 66eb5eaad38b6dfaa885061779aa3218ccf162d5 Mon Sep 17 00:00:00 2001 From: Francis Gallagher Date: Tue, 21 Nov 2023 13:50:05 +0000 Subject: [PATCH 1/4] fix: magerun command now handles config override correctly --- cmd/magerun.go | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/cmd/magerun.go b/cmd/magerun.go index 7c0f2c4..5d87e04 100644 --- a/cmd/magerun.go +++ b/cmd/magerun.go @@ -24,11 +24,9 @@ var MagerunCmd = &cobra.Command{ //empty pre run to stop execution of parent RootCmd pre run }, RunE: func(cmd *cobra.Command, args []string) error { - // handle global arguments (e.g. --config, --debug) as root command cannot due to DisableFlagParsing var globalArguments = handleGlobalArguments(args) magerunArgs := args[len(globalArguments):] - if len(magerunArgs) < 1 { return fmt.Errorf("no command provided") } @@ -99,22 +97,42 @@ func initializeModuleWhichRequireConfig() { func handleGlobalArguments(args []string) []string { // Replicates RootCmd.PersistentPreRunE as it is not usable when DisableFlagParsing is set to true + // global Arg handling must be done manually var globalArguments []string var overrideFilePath string - for _, arg := range args { + + //Note arguments between start and magerun command. + for i, arg := range args { if strings.HasPrefix(arg, "--") { globalArguments = append(globalArguments, arg) - if strings.HasPrefix(arg, "--config") { - // Catch both --config /file/path and --config=/file/path - overrideFilePath = strings.TrimPrefix(arg, "--config=") - overrideFilePath = strings.TrimPrefix(arg, "--config ") - } - if strings.HasPrefix(arg, "--debug") { + //if arg is --debug then enable debug mode + if arg == "--debug" { + logger.Warnf("Magerun: Debug mode enabled") logger.EnableDebugMode() } - } - if !strings.HasPrefix(arg, "--") { + + //if arg is --config then configure + if strings.HasPrefix(arg, "--config") { + var configPath string + if strings.Contains(arg, "=") { + configPath = strings.Split(arg, "=")[1] + } else { + //ensure next argument is config path + if len(args) > i+1 && !strings.HasPrefix(args[i+1], "--") { + configPath = args[i+1] + //Ensure we remove the config path from args to avoid breaking early + args = append(args[:i+1], args[i+2:]...) + } + } + if configPath == "" { + logger.Warnf("No config file path provided with argument, using default config file path") + } + + overrideFilePath = strings.Trim(configPath, `"'`) + } + } else { + //We have reached the magerun command, so exit loop break } } From 544767eb153363ee7707b6ceb30ca8cf432cfa99 Mon Sep 17 00:00:00 2001 From: Francis Gallagher Date: Wed, 22 Nov 2023 16:06:44 +0000 Subject: [PATCH 2/4] fix: log formatting + add disallow override file option to config --- README.md | 17 +++++--- cmd/magerun.go | 10 +++-- config_manager/base_config.go | 77 +++++++++++++++++++++++------------ logger/logger.go | 51 +++++++++++++++-------- main.go | 11 ++--- 5 files changed, 109 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 799294b..79062cc 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,6 @@ The tool looks for a configuration file in `/etc/magecomm/`(unix) / `%APPDATA%\m ## Beta Currently this tool is in beta, and is not recommended for production use. -Tested commands: RMQ based magerun command publishing, message listening, cat all supported archive types - ## Installation @@ -22,6 +20,7 @@ Download the latest release from the [releases page](https://github.com/furan917 example config.yml: ``` +disallow_configfile_overwrite: true magecomm_log_path: /var/log/magecomm.log magecomm_log_level: warn magecomm_max_operational_cpu_limit: 80 @@ -64,6 +63,7 @@ magecomm_required_magerun_command_args: example config.json: ``` { + "disallow_configfile_overwrite": true, "magecomm_log_path": "/var/log/magecomm.log", "magecomm_log_level": "warn", "magecomm_max_operational_cpu_limit": 80, @@ -117,11 +117,14 @@ example config.json: ### Global Flags - `--debug`: Enable debug mode +- `--config`: Path to overwrite config file, argument can be disabled by default config file e.g `magecomm --debug listen` `magecomm --debug magerun cache:clean` `magecomm --debug cat path/to/archive.tar.gz /path/to/file.txt` +`magecomm --config=/custom/config/path.json magerun indexer:status` +`magecomm --config=/custom/config/path.json --debug magerun indexer:reindex` ### Commands @@ -143,11 +146,15 @@ e.g ## Configuration -The tool can be configured using a yaml or json config file at `/etc/magecomm/`(unix) / `%APPDATA%\magecomm\`(windows) or by environment variables. -lowercase for file based config, uppercase for ENV. +The tool can be configured using a yaml or json config file at `/etc/magecomm/` (unix) | `%APPDATA%\magecomm\` (windows), or using `--config=/custom/config/path.json` before the command e.g. `magecomm --config=... magerun`, or by ENV variables. +Magecomm has a fallback strategy of, config file -> ENV -> default values + +_You can disable by the config override argument by placing `disallow_configfile_overwrite: true` in the default config file_ -The tool supports slack command run notifications via Webhook or App integration +The tool can also supports slack command run notifications via Webhook or App integration +## Config Options +_All caps for envs, lowercase for config file_ - `MAGECOMM_LOG_PATH`: Path to log file, default: SYSLOG - `MAGECOMM_LOG_LEVEL`: Log level, default: WARN, options (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, PANIC) - `MAGECOMM_MAX_OPERATIONAL_CPU_LIMIT`: Maximum CPU limit of system before we defer processing messages, default: 80 diff --git a/cmd/magerun.go b/cmd/magerun.go index 5d87e04..e764742 100644 --- a/cmd/magerun.go +++ b/cmd/magerun.go @@ -100,16 +100,16 @@ func handleGlobalArguments(args []string) []string { // global Arg handling must be done manually var globalArguments []string var overrideFilePath string + var enableDebugLogging bool //Note arguments between start and magerun command. for i, arg := range args { if strings.HasPrefix(arg, "--") { globalArguments = append(globalArguments, arg) - //if arg is --debug then enable debug mode + //if arg is --debug then flag debug to be enabled after configuration step if arg == "--debug" { - logger.Warnf("Magerun: Debug mode enabled") - logger.EnableDebugMode() + enableDebugLogging = true } //if arg is --config then configure @@ -137,6 +137,10 @@ func handleGlobalArguments(args []string) []string { } } + if enableDebugLogging { + logger.EnableDebugMode() + } + config_manager.Configure(overrideFilePath) initializeModuleWhichRequireConfig() diff --git a/config_manager/base_config.go b/config_manager/base_config.go index 2045535..b3e2b20 100644 --- a/config_manager/base_config.go +++ b/config_manager/base_config.go @@ -105,49 +105,74 @@ func getDefault(key string) string { } func Configure(overrideFile string) { - if overrideFile != "" { - viper.SetConfigFile(overrideFile) - } else { - // Set base folder and file name of config file - viper.SetConfigName("config") - if runtime.GOOS == "windows" { - viper.AddConfigPath(os.Getenv("APPDATA") + "\\magecomm\\") - } else { - viper.AddConfigPath("/etc/magecomm/") - } - // Search for json config file first, then fallback to yaml - viper.SetConfigType("json") - if err := viper.ReadInConfig(); err != nil { - viper.SetConfigType("yaml") - } + overrideFile = strings.TrimSpace(overrideFile) + overrideFile = strings.Trim(overrideFile, `'"`) + defaultConfigError := configureDefaultsConfig() + disallowOverwrite := viper.GetBool("disallow_configfile_overwrite") + + if disallowOverwrite && overrideFile != "" { + logger.Warnf("Config file overwriting is disallowed, ignoring passed in config file") } - err := viper.ReadInConfig() - if err != nil { - // If the configuration file does not exist, warn user that env vars will be used - var configFileNotFoundError viper.ConfigFileNotFoundError - if errors.As(err, &configFileNotFoundError) { - logger.Infof("No config file found, reading fully from env vars, this is less secure") - } else { - logger.Warnf("Failed to read the config file, reading from ENV vars, this is less secure: %v", err) - return + if !disallowOverwrite && overrideFile != "" { + viper.Reset() + viper.SetConfigFile(overrideFile) + err := viper.ReadInConfig() + if err != nil { + if defaultConfigError == nil { + logger.Warnf("Failed to read the config file, reapplying default config") + err := configureDefaultsConfig() + if err != nil { + // We checked for this above, so this should never happen + } + } else { + logger.Warnf("Failed to read the both the override and default config file, defaulting to env variable reading") + } } } if logPath := GetValue(ConfigLogPath); logPath != "" { logger.ConfigureLogPath(logPath) - logger.Infof("Logging to file: %s", logPath) } if logLevel := GetValue(ConfigLogLevel); logLevel != "" { logger.SetLogLevel(logLevel) - logger.Infof("Logging level set to: %s", logLevel) } configName := viper.ConfigFileUsed() logger.Infof("Using config file: %s", configName) } +func configureDefaultsConfig() error { + viper.Reset() + + viper.SetConfigName("config") + if runtime.GOOS == "windows" { + viper.AddConfigPath(os.Getenv("APPDATA") + "\\magecomm\\") + } else { + viper.AddConfigPath("/etc/magecomm/") + } + // Search for json config file first, then fallback to yaml + viper.SetConfigType("json") + if err := viper.ReadInConfig(); err != nil { + viper.SetConfigType("yaml") + } + err := viper.ReadInConfig() + if err != nil { + // If the configuration file does not exist, warn user that env vars will be used + var configFileNotFoundError viper.ConfigFileNotFoundError + if errors.As(err, &configFileNotFoundError) { + logger.Infof("No default config file found, reading fully from env vars, this is less secure") + return err + } else { + logger.Warnf("Failed to read the default config file, reading from ENV vars, this is less secure: %v", err) + return err + } + } + + return nil +} + func GetBoolValue(key string) bool { value := GetValue(key) for _, v := range trueValues { diff --git a/logger/logger.go b/logger/logger.go index 4b1cc76..4cdf895 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -1,6 +1,6 @@ package logger -// This package is used to log messages easily It is a wrapper around the logrus package. +// This package is used to Log messages easily It is a wrapper around the logrus package. import ( "github.com/sirupsen/logrus" @@ -19,14 +19,17 @@ const ( PanicLevel = logrus.PanicLevel ) -var Log *logrus.Logger +var ( + Log *logrus.Logger + debugFlagSet bool +) func init() { - logrus.SetFormatter(&logrus.TextFormatter{ + Log = logrus.StandardLogger() + Log.SetFormatter(&logrus.TextFormatter{ FullTimestamp: true, }) - logrus.SetLevel(logrus.WarnLevel) - Log = logrus.StandardLogger() + Log.SetLevel(logrus.WarnLevel) } func ConfigureLogPath(logFile string) { @@ -37,18 +40,23 @@ func ConfigureLogPath(logFile string) { if _, err := os.Stat(logFile); os.IsNotExist(err) { if err := createLogFile(logFile); err != nil { - Log.Errorf("Unable to create log file, please contact your system administrator") + Log.Errorf("Unable to create Log file, please contact your system administrator") } } file, err := os.OpenFile(logFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0755) if err != nil { - logrus.SetOutput(os.Stdout) - Log.Errorf("Unable to open log file, printing to stdout, please contact your system administrator") + Log.SetOutput(os.Stdout) + Log.Errorf("Unable to open Log file, printing to stdout, please contact your system administrator") return } - logrus.SetOutput(file) + //Log.SetFormatter(&logrus.JSONFormatter{}) + Log.SetFormatter(&logrus.TextFormatter{ + FullTimestamp: true, + }) + Log.SetOutput(file) + Log.Infof("Logging to file: %s", file.Name()) } func createLogFile(logFile string) error { @@ -58,7 +66,7 @@ func createLogFile(logFile string) error { } defer func(file *os.File) { if err := file.Close(); err != nil { - Log.Fatal("Unable to close log file, please contact your system administrator") + Log.Fatal("Unable to close Log file, please contact your system administrator") } }(file) return nil @@ -66,16 +74,23 @@ func createLogFile(logFile string) error { func EnableDebugMode() { SetLogLevel(logrus.DebugLevel.String()) + debugFlagSet = true } func SetLogLevel(level string) { + if debugFlagSet { + Log.Info("Debug mode enabled by flag, ignoring log level configuration") + return + } + logrusLevel, err := logrus.ParseLevel(strings.ToLower(level)) if err != nil { - logrus.Warnf("Invalid log level: %s, defaulting to %s", level, logrus.WarnLevel.String()) + Log.Warnf("Invalid Log level: %s, defaulting to %s", level, logrus.WarnLevel.String()) logrusLevel = logrus.WarnLevel } - logrus.SetLevel(logrusLevel) + Log.SetLevel(logrusLevel) + Log.Infof("Log level set to %s", logrusLevel) } func Trace(args ...interface{}) { @@ -111,25 +126,25 @@ func Tracef(format string, args ...interface{}) { } func Debugf(format string, args ...interface{}) { - logrus.Debugf(format, args...) + Log.Debugf(format, args...) } func Infof(format string, args ...interface{}) { - logrus.Infof(format, args...) + Log.Infof(format, args...) } func Warnf(format string, args ...interface{}) { - logrus.Warnf(format, args...) + Log.Warnf(format, args...) } func Errorf(format string, args ...interface{}) { - logrus.Errorf(format, args...) + Log.Errorf(format, args...) } func Fatalf(format string, args ...interface{}) { - logrus.Fatalf(format, args...) + Log.Fatalf(format, args...) } func Panicf(format string, args ...interface{}) { - logrus.Panicf(format, args...) + Log.Panicf(format, args...) } diff --git a/main.go b/main.go index 7f2df68..4efa9dc 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "magecomm/logger" "magecomm/notifictions" "magecomm/services" + "strings" ) var RootCmd = &cobra.Command{ @@ -14,14 +15,14 @@ var RootCmd = &cobra.Command{ Short: "MageComm CLI is a command line tool for managing Magento applications", PersistentPreRun: func(cmd *cobra.Command, args []string) { - overrideFilePath, _ := cmd.Flags().GetString("config") - config_manager.Configure(overrideFilePath) - initializeModuleWhichRequireConfig() - debug, _ := cmd.Flags().GetBool("debug") if debug { logger.EnableDebugMode() } + + overrideFilePath, _ := cmd.Flags().GetString("config") + config_manager.Configure(overrideFilePath) + initializeModuleWhichRequireConfig() }, } @@ -43,6 +44,6 @@ func main() { err := RootCmd.Execute() if err != nil { - logger.Fatalf("Failed to execute command: %s", err) + logger.Fatalf("Failed to execute command: %s", strings.ReplaceAll(err.Error(), "\n", " ")) } } From 229a649443ffa8da1dd849ff26231e7ede389885 Mon Sep 17 00:00:00 2001 From: Francis Gallagher Date: Wed, 22 Nov 2023 23:13:56 +0000 Subject: [PATCH 3/4] fix: small fix for graceful interupts + some whitespacing fixes --- cmd/listen.go | 13 +- messages/listener/rmq.go | 274 ++++++++++++++++++++------------------- messages/listener/sqs.go | 3 +- 3 files changed, 149 insertions(+), 141 deletions(-) diff --git a/cmd/listen.go b/cmd/listen.go index 20f747b..0ace41b 100644 --- a/cmd/listen.go +++ b/cmd/listen.go @@ -39,12 +39,17 @@ var ListenCmd = &cobra.Command{ return fmt.Errorf("error creating listener: %s", err) } - // Create a channel to handle program termination or interruption signals so we can kill any connections if needed + //Create a channel to handle program termination or interruption signals so we can kill any connections if needed sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) - go listener.ListenToService(queueNames) - <-sigChan - listener.Close() + go func() { + <-sigChan + logger.Infof("Received interruption signal. Shutting down gracefully...") + listener.Close() + os.Exit(0) + }() + + listener.ListenToService(queueNames) return nil }, diff --git a/messages/listener/rmq.go b/messages/listener/rmq.go index a78ee0f..c121246 100644 --- a/messages/listener/rmq.go +++ b/messages/listener/rmq.go @@ -1,165 +1,167 @@ package listener import ( - "errors" - "fmt" - "github.com/streadway/amqp" - "magecomm/config_manager/system_limits" - "magecomm/logger" - "magecomm/messages/handler" - "magecomm/messages/queues" - "magecomm/services" - "sync" + "errors" + "fmt" + "github.com/streadway/amqp" + "magecomm/config_manager/system_limits" + "magecomm/logger" + "magecomm/messages/handler" + "magecomm/messages/queues" + "magecomm/services" + "sync" ) type RmqListener struct { - ChannelPool *services.RabbitMQChannelPool - done chan struct{} - wg sync.WaitGroup + ChannelPool *services.RabbitMQChannelPool + stopChan chan struct{} + waitGroup sync.WaitGroup } func (listener *RmqListener) shouldExecutionBeDelayed() error { - totalDeferTime := 0 - for system_limits.CheckIfOutsideOperationalLimits() { - system_limits.SystemLimitCheckSleep() - totalDeferTime += int(system_limits.WaitTimeBetweenChecks) + totalDeferTime := 0 + for system_limits.CheckIfOutsideOperationalLimits() { + system_limits.SystemLimitCheckSleep() + totalDeferTime += int(system_limits.WaitTimeBetweenChecks) - if totalDeferTime > int(system_limits.MaxDeferralTime) { - return errors.New("max deferral time exceeded") - } - } + if totalDeferTime > int(system_limits.MaxDeferralTime) { + return errors.New("max deferral time exceeded") + } + } - return nil + return nil } func (listener *RmqListener) processRmqMessage(message amqp.Delivery, channel *amqp.Channel, queueName string) { - logger.Debugf("Message received from %s", queueName) - correlationID := message.CorrelationId - if message.Headers == nil { - message.Headers = make(amqp.Table) - } - - retryCount, ok := message.Headers["RetryCount"] - if !ok { - retryCount = int32(0) - } - - err := listener.shouldExecutionBeDelayed() - if err != nil { - logger.Warnf("Message deferral time exceeded. Dropping hold on the message.") - message.Headers["RetryCount"] = retryCount.(int32) + 1 - _, err := services.PublishRmqMessage(channel, queueName, message.Body, message.Headers, correlationID) - if err != nil { - logger.Warnf("Failed to republish publish message: %v", err) - } - return - } - if err := handler.HandleReceivedMessage(string(message.Body), queueName, correlationID); err != nil { - logger.Warnf("Failed to process message: %v", err) - if retryCount.(int32) < handler.MessageRetryLimit { - message.Headers["RetryCount"] = retryCount.(int32) + 1 - _, err := services.PublishRmqMessage(channel, queueName, message.Body, message.Headers, correlationID) - if err != nil { - logger.Warnf("Failed to republish publish message: %v", err) - } - } else { - logger.Warnf("Retry count exceeded. Discarding the message.") - } - } + logger.Debugf("Message received from %s", queueName) + correlationID := message.CorrelationId + if message.Headers == nil { + message.Headers = make(amqp.Table) + } + + retryCount, ok := message.Headers["RetryCount"] + if !ok { + retryCount = int32(0) + } + + err := listener.shouldExecutionBeDelayed() + if err != nil { + logger.Warnf("Message deferral time exceeded. Dropping hold on the message.") + message.Headers["RetryCount"] = retryCount.(int32) + 1 + _, err := services.PublishRmqMessage(channel, queueName, message.Body, message.Headers, correlationID) + if err != nil { + logger.Warnf("Failed to republish publish message: %v", err) + } + return + } + if err := handler.HandleReceivedMessage(string(message.Body), queueName, correlationID); err != nil { + logger.Warnf("Failed to process message: %v", err) + if retryCount.(int32) < handler.MessageRetryLimit { + message.Headers["RetryCount"] = retryCount.(int32) + 1 + _, err := services.PublishRmqMessage(channel, queueName, message.Body, message.Headers, correlationID) + if err != nil { + logger.Warnf("Failed to republish publish message: %v", err) + } + } else { + logger.Warnf("Retry count exceeded. Discarding the message.") + } + } } func (listener *RmqListener) listenToQueue(queueName string) { - defer listener.wg.Done() - - channel, err := listener.ChannelPool.Get() - if err != nil { - logger.Warnf("Error getting channel from pool: %v", err) - return - } - defer listener.ChannelPool.Put(channel) - - queueNameWithConfigPrefix, err := services.CreateRmqQueue(channel, queueName) - if err != nil { - return - } - msgs, err := channel.Consume( - queueNameWithConfigPrefix, - "", - true, - false, - false, - false, - nil, - ) - if err != nil { - logger.Fatalf("%s: %s", "Failed to register a consumer", err) - } - - for { - select { - case message, ok := <-msgs: - if !ok { - return - } - listener.processRmqMessage(message, channel, queueName) - case <-listener.done: - return - } - } + defer listener.waitGroup.Done() + + channel, err := listener.ChannelPool.Get() + if err != nil { + logger.Warnf("Error getting channel from pool: %v", err) + return + } + defer listener.ChannelPool.Put(channel) + + queueNameWithConfigPrefix, err := services.CreateRmqQueue(channel, queueName) + if err != nil { + return + } + msgs, err := channel.Consume( + queueNameWithConfigPrefix, + "", + true, + false, + false, + false, + nil, + ) + if err != nil { + logger.Fatalf("%s: %s", "Failed to register a consumer", err) + } + + for { + select { + case message, ok := <-msgs: + if !ok { + return + } + listener.processRmqMessage(message, channel, queueName) + case <-listener.stopChan: + return + } + } } func (listener *RmqListener) ListenForOutputByCorrelationID(queueName string, correlationID string) (string, error) { - queueName = queues.MapQueueToOutputQueue(queueName) - channel, err := listener.ChannelPool.Get() - if err != nil { - logger.Warnf("Error getting channel from pool: %v", err) - return "", err - } - defer listener.ChannelPool.Put(channel) - - queueNameWithConfigPrefix, err := services.CreateRmqQueue(channel, queueName) - if err != nil { - return "", err - } - msgs, err := channel.Consume( - queueNameWithConfigPrefix, - "", - false, - false, - false, - false, - nil, - ) - if err != nil { - return "", fmt.Errorf("failed to consume messages: %s", err) - } - - for msg := range msgs { - if correlationID == msg.CorrelationId { - output := string(msg.Body) - err = msg.Ack(false) - if err != nil { - return "", fmt.Errorf("failed to acknowledge message: %s", err) - } - - return output, nil - } - } - - return "", fmt.Errorf("failed to receive message with correlation ID: %s", correlationID) + queueName = queues.MapQueueToOutputQueue(queueName) + channel, err := listener.ChannelPool.Get() + if err != nil { + logger.Warnf("Error getting channel from pool: %v", err) + return "", err + } + defer listener.ChannelPool.Put(channel) + + queueNameWithConfigPrefix, err := services.CreateRmqQueue(channel, queueName) + if err != nil { + return "", err + } + msgs, err := channel.Consume( + queueNameWithConfigPrefix, + "", + false, + false, + false, + false, + nil, + ) + if err != nil { + return "", fmt.Errorf("failed to consume messages: %s", err) + } + + for msg := range msgs { + if correlationID == msg.CorrelationId { + output := string(msg.Body) + err = msg.Ack(false) + if err != nil { + return "", fmt.Errorf("failed to acknowledge message: %s", err) + } + + return output, nil + } + } + + return "", fmt.Errorf("failed to receive message with correlation ID: %s", correlationID) } func (listener *RmqListener) ListenToService(queueNames []string) { - listener.done = make(chan struct{}) + listener.stopChan = make(chan struct{}) - for _, queueName := range queueNames { - listener.wg.Add(1) - go listener.listenToQueue(queueName) - } + for _, queueName := range queueNames { + listener.waitGroup.Add(1) + go listener.listenToQueue(queueName) + } - listener.wg.Wait() + listener.waitGroup.Wait() } func (listener *RmqListener) Close() { - close(listener.done) + close(listener.stopChan) + logger.Infof("Stopped listening to queues") + fmt.Println("Stopped listening to queues") } diff --git a/messages/listener/sqs.go b/messages/listener/sqs.go index 6c24814..2d5494d 100644 --- a/messages/listener/sqs.go +++ b/messages/listener/sqs.go @@ -200,5 +200,6 @@ func (listener *SqsListener) ListenToService(queueNames []string) { func (listener *SqsListener) Close() { close(listener.stopChan) - listener.waitGroup.Wait() + logger.Infof("Stopped listening to queues") + fmt.Println("Stopped listening to queues") } From 8fb91358f367b1ea1a053929cda9b0cf7f16e0ed Mon Sep 17 00:00:00 2001 From: Francis Date: Thu, 23 Nov 2023 16:51:28 +0000 Subject: [PATCH 4/4] chore(main): release 0.1.10 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1629219..dd8007c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [0.1.10](https://github.com/furan917/MageComm/compare/v0.1.9...v0.1.10) (2023-11-23) + + +### Bug Fixes + +* log formatting + add disallow override file option to config ([544767e](https://github.com/furan917/MageComm/commit/544767eb153363ee7707b6ceb30ca8cf432cfa99)) +* magerun command now handles config override correctly ([66eb5ea](https://github.com/furan917/MageComm/commit/66eb5eaad38b6dfaa885061779aa3218ccf162d5)) +* small fix for graceful interupts + some whitespacing fixes ([229a649](https://github.com/furan917/MageComm/commit/229a649443ffa8da1dd849ff26231e7ede389885)) + ## [0.1.9](https://github.com/furan917/MageComm/compare/v0.1.8...v0.1.9) (2023-10-11)