Skip to content

Commit

Permalink
refactor(BUX-411): adjustments to bux taskmanager
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-4chain committed Dec 19, 2023
1 parent 0b2c90f commit ebc788a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 25 deletions.
3 changes: 1 addition & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 3 additions & 17 deletions config/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 0 additions & 5 deletions config/task_manager.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package config

import (
"github.com/BuxOrg/bux/taskmanager"
)

// TaskManager defaults
const (
TaskManagerEngine = taskmanager.TaskQ
TaskManagerQueueName = "bux_queue"
)
2 changes: 1 addition & 1 deletion go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ebc788a

Please sign in to comment.