Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benleb committed Aug 1, 2023
1 parent f61decc commit 7a8dc3a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
9 changes: 5 additions & 4 deletions cmd/live.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ func runGloomberg(_ *cobra.Command, _ []string) {
//
var seawa *seawatcher.SeaWatcher
if viper.GetBool("seawatcher.enabled") || viper.GetBool("listings.enabled") {
var oopenseaAPIKey string
var openseaAPIKey string
if key := viper.GetString("api_keys.opensea"); key != "" {
oopenseaAPIKey = viper.GetString("api_keys.opensea")
openseaAPIKey = viper.GetString("api_keys.opensea")
} else if key := viper.GetString("seawatcher.api_key"); key != "" {
oopenseaAPIKey = viper.GetString("seawatcher.api_key")
openseaAPIKey = viper.GetString("seawatcher.api_key")
}
seawa = seawatcher.NewSeaWatcher(oopenseaAPIKey, gb)
seawa = seawatcher.NewSeaWatcher(openseaAPIKey, gb)
}

// trapri | ttx printer to process and format the token transactions
Expand Down Expand Up @@ -563,6 +563,7 @@ func init() { //nolint:gochecknoinits
viper.SetDefault("trapri.numOpenSeaEventhandlers", 3)

// eventhub
viper.SetDefault("gloomberg.terminalPrinter.numWorker", 1)
viper.SetDefault("gloomberg.eventhub.numHandler", 1)
viper.SetDefault("gloomberg.eventhub.inQueuesSize", 256)
viper.SetDefault("gloomberg.eventhub.outQueuesSize", 32)
Expand Down
32 changes: 19 additions & 13 deletions internal/nemo/gloomberg/gloomberg.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ func New() *Gloomberg {
}

clientName := hostname + "_gloomberg_v" + internal.GloombergVersion
redisClientOptions := rueidis.ClientOption{InitAddress: []string{connectAddr}, ClientName: clientName}
redisClientOptions := rueidis.ClientOption{
InitAddress: []string{connectAddr},
ClientName: clientName,
}

rdb := getRedisClient(redisClientOptions)

Expand All @@ -141,22 +144,25 @@ func New() *Gloomberg {

//
// start central terminal printer
go func() {
gbl.Log.Debug("starting terminal printer...")
printToTerminalChannel := gb.SubscribePrintToTerminal()

printToTerminalChannel := gb.SubscribePrintToTerminal()
// experimental: start multiple terminal printers
for i := 0; i < viper.GetInt("gloomberg.terminalPrinter.numWorker"); i++ {
go func() {
gbl.Log.Debug("starting terminal printer...")

for eventLine := range printToTerminalChannel {
gbl.Log.Debugf("terminal printer eventLine: %s", eventLine)
for eventLine := range printToTerminalChannel {
gbl.Log.Debugf("terminal printer eventLine: %s", eventLine)

if viper.GetBool("log.debug") {
debugPrefix := fmt.Sprintf("%d | ", len(printToTerminalChannel))
eventLine = fmt.Sprint(debugPrefix, eventLine)
}
if viper.GetBool("log.debug") {
debugPrefix := fmt.Sprintf("%d | ", len(printToTerminalChannel))
eventLine = fmt.Sprint(debugPrefix, eventLine)
}

fmt.Println(eventLine)
}
}()
fmt.Println(eventLine)
}
}()
}

// load print configurations to pretty style prints from our different "modules"
gb.PrintConfigurations = make(map[string]*printConfig)
Expand Down

0 comments on commit 7a8dc3a

Please sign in to comment.