From ebc788a40f573f681e230c19704d65421dbacf76 Mon Sep 17 00:00:00 2001 From: Krzysztof Tomecki <152964795+chris-4chain@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:34:45 +0100 Subject: [PATCH] refactor(BUX-411): adjustments to bux taskmanager --- cmd/server/main.go | 3 +-- config/services.go | 20 +++----------------- config/task_manager.go | 5 ----- go.mod | 2 +- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index 06b1c862d..01f9185c7 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -51,10 +51,9 @@ func main() { // (debugging: show services that are enabled or not) if appConfig.Debug { services.Logger.Debug().Msgf( - "datastore: %s | cachestore: %s | taskmanager: %s [%s] | new_relic: %t | paymail: %t | graphql: %t", + "datastore: %s | cachestore: %s | taskmanager: %s | new_relic: %t | paymail: %t | graphql: %t", appConfig.Db.Datastore.Engine.String(), appConfig.Cache.Engine.String(), - config.TaskManagerEngine, appConfig.TaskManager.Factory.String(), appConfig.NewRelic.Enabled, appConfig.Paymail.Enabled, diff --git a/config/services.go b/config/services.go index cc1688a85..67aa7f04b 100644 --- a/config/services.go +++ b/config/services.go @@ -394,23 +394,9 @@ func splitBroadcastClientApis(apis []string) []broadcastclient.ArcClientConfig { } func loadTaskManager(appConfig *AppConfig, options []bux.ClientOps) []bux.ClientOps { - // Load task manager (redis or taskq) - // todo: this needs more improvement with redis options etc - if TaskManagerEngine == taskmanager.TaskQ { - config := taskmanager.DefaultTaskQConfig(TaskManagerQueueName) - if appConfig.TaskManager.Factory == taskmanager.FactoryRedis { - options = append( - options, - bux.WithTaskQUsingRedis( - config, - &redis.Options{ - Addr: strings.Replace(appConfig.Cache.Redis.URL, "redis://", "", -1), - }, - )) - } else { - options = append(options, bux.WithTaskQ(config, appConfig.TaskManager.Factory)) - } - } + options = append(options, bux.WithTaskqConfig( + taskmanager.DefaultTaskQConfig(TaskManagerQueueName, taskmanager.WithRedis(appConfig.Cache.Redis.URL)), + )) return options } diff --git a/config/task_manager.go b/config/task_manager.go index 885f162f3..506367381 100644 --- a/config/task_manager.go +++ b/config/task_manager.go @@ -1,11 +1,6 @@ package config -import ( - "github.com/BuxOrg/bux/taskmanager" -) - // TaskManager defaults const ( - TaskManagerEngine = taskmanager.TaskQ TaskManagerQueueName = "bux_queue" ) diff --git a/go.mod b/go.mod index 6d4f3b43c..c1d12abd2 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/99designs/gqlgen v0.17.41 - github.com/BuxOrg/bux v0.8.1 + github.com/BuxOrg/bux v0.9.0 github.com/BuxOrg/bux-models v0.2.1 github.com/bitcoin-sv/go-broadcast-client v0.9.0 github.com/go-ozzo/ozzo-validation v3.6.0+incompatible