mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-01 07:26:48 +00:00
alert: Add optimizations (#939)
* alert: Add optimizations * alert: add basic benchmarks * alert: fix linter issue * documentation: change to text/template as html/template escapes to protect against code injection. Add readme.md for alert. * README: Add package name * alert: link up with engine settings * request: isVerbose refactor * Update exchanges/alert/alert_test.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update exchanges/alert/alert.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits * glorious: fun police * documentation: regen Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/thrasher-corp/gocryptotrader/currency"
|
||||
"github.com/thrasher-corp/gocryptotrader/dispatch"
|
||||
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/alert"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/trade"
|
||||
@@ -250,6 +251,15 @@ func validateSettings(b *Engine, s *Settings, flagSet FlagSet) {
|
||||
err)
|
||||
}
|
||||
}
|
||||
|
||||
if b.Settings.AlertSystemPreAllocationCommsBuffer != alert.PreAllocCommsDefaultBuffer {
|
||||
err = alert.SetPreAllocationCommsBuffer(b.Settings.AlertSystemPreAllocationCommsBuffer)
|
||||
if err != nil {
|
||||
gctlog.Errorf(gctlog.Global, "Could not set alert pre-allocation comms buffer to %v: %v",
|
||||
b.Settings.AlertSystemPreAllocationCommsBuffer,
|
||||
err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PrintSettings returns the engine settings
|
||||
@@ -309,6 +319,7 @@ func PrintSettings(s *Settings) {
|
||||
gctlog.Debugf(gctlog.Global, "\t Max HTTP request jobs: %v", s.MaxHTTPRequestJobsLimit)
|
||||
gctlog.Debugf(gctlog.Global, "\t HTTP request max retry attempts: %v", s.RequestMaxRetryAttempts)
|
||||
gctlog.Debugf(gctlog.Global, "\t Trade buffer processing interval: %v", s.TradeBufferProcessingInterval)
|
||||
gctlog.Debugf(gctlog.Global, "\t Alert communications channel pre-allocation buffer size: %v", s.AlertSystemPreAllocationCommsBuffer)
|
||||
gctlog.Debugf(gctlog.Global, "\t HTTP timeout: %v", s.HTTPTimeout)
|
||||
gctlog.Debugf(gctlog.Global, "\t HTTP user agent: %v", s.HTTPUserAgent)
|
||||
gctlog.Debugf(gctlog.Global, "- GCTSCRIPT SETTINGS: ")
|
||||
|
||||
@@ -60,17 +60,18 @@ type Settings struct {
|
||||
EnableExchangeRateHost bool
|
||||
|
||||
// Exchange tuning settings
|
||||
EnableExchangeHTTPRateLimiter bool
|
||||
EnableExchangeHTTPDebugging bool
|
||||
EnableExchangeVerbose bool
|
||||
ExchangePurgeCredentials bool
|
||||
EnableExchangeAutoPairUpdates bool
|
||||
DisableExchangeAutoPairUpdates bool
|
||||
EnableExchangeRESTSupport bool
|
||||
EnableExchangeWebsocketSupport bool
|
||||
MaxHTTPRequestJobsLimit int
|
||||
TradeBufferProcessingInterval time.Duration
|
||||
RequestMaxRetryAttempts int
|
||||
EnableExchangeHTTPRateLimiter bool
|
||||
EnableExchangeHTTPDebugging bool
|
||||
EnableExchangeVerbose bool
|
||||
ExchangePurgeCredentials bool
|
||||
EnableExchangeAutoPairUpdates bool
|
||||
DisableExchangeAutoPairUpdates bool
|
||||
EnableExchangeRESTSupport bool
|
||||
EnableExchangeWebsocketSupport bool
|
||||
MaxHTTPRequestJobsLimit int
|
||||
TradeBufferProcessingInterval time.Duration
|
||||
RequestMaxRetryAttempts int
|
||||
AlertSystemPreAllocationCommsBuffer int // See exchanges/alert.go
|
||||
|
||||
// Global HTTP related settings
|
||||
GlobalHTTPTimeout time.Duration
|
||||
|
||||
Reference in New Issue
Block a user