fix: default gateway callback batching off

This commit is contained in:
hectorzhao
2026-08-26 13:59:21 +08:00
parent 4a17df78b8
commit 8170f727a3
5 changed files with 38 additions and 1 deletions
+5 -1
View File
@@ -95,7 +95,7 @@ func main() {
resultOutbox.Consumer = getenv("GATEWAY_SUBMIT_RESULT_CONSUMER", "gateway-1")
resultOutbox.APIBaseURL = callbackBaseURL
resultOutbox.Concurrency = positiveEnvInt("GATEWAY_SUBMIT_RESULT_WORKER_CONCURRENCY", 8)
resultOutbox.BatchEnabled = os.Getenv("GATEWAY_CALLBACK_BATCH_ENABLED") != "false"
resultOutbox.BatchEnabled = enabledEnv("GATEWAY_CALLBACK_BATCH_ENABLED")
resultOutbox.BatchSize = positiveEnvInt("GATEWAY_CALLBACK_BATCH_SIZE", 50)
resultOutbox.BatchWait = time.Duration(positiveEnvInt("GATEWAY_CALLBACK_BATCH_WAIT_MS", 10)) * time.Millisecond
resultOutbox.GatewayInstanceID = gatewayInstanceID
@@ -234,6 +234,10 @@ func positiveEnvInt(key string, fallback int) int {
return value
}
func enabledEnv(key string) bool {
return os.Getenv(key) == "true"
}
func hostname() string {
name, err := os.Hostname()
if err != nil || name == "" {