refactor: merge retry target type into http (max_retries=0 = fire-and-forget)
All checks were successful
check / check (push) Successful in 1m46s
All checks were successful
check / check (push) Successful in 1m46s
This commit is contained in:
@@ -519,16 +519,16 @@ func (h *Handlers) HandleTargetCreate() http.HandlerFunc {
|
||||
|
||||
// Validate target type
|
||||
switch targetType {
|
||||
case database.TargetTypeHTTP, database.TargetTypeRetry, database.TargetTypeDatabase, database.TargetTypeLog:
|
||||
case database.TargetTypeHTTP, database.TargetTypeDatabase, database.TargetTypeLog:
|
||||
// valid
|
||||
default:
|
||||
http.Error(w, "Invalid target type", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Build config JSON for HTTP-based targets
|
||||
// Build config JSON for HTTP targets
|
||||
var configJSON string
|
||||
if targetType == database.TargetTypeHTTP || targetType == database.TargetTypeRetry {
|
||||
if targetType == database.TargetTypeHTTP {
|
||||
if url == "" {
|
||||
http.Error(w, "URL is required for HTTP targets", http.StatusBadRequest)
|
||||
return
|
||||
@@ -544,9 +544,9 @@ func (h *Handlers) HandleTargetCreate() http.HandlerFunc {
|
||||
configJSON = string(configBytes)
|
||||
}
|
||||
|
||||
maxRetries := 5
|
||||
maxRetries := 0 // default: fire-and-forget (no retries)
|
||||
if maxRetriesStr != "" {
|
||||
if v, err := strconv.Atoi(maxRetriesStr); err == nil && v > 0 {
|
||||
if v, err := strconv.Atoi(maxRetriesStr); err == nil && v >= 0 {
|
||||
maxRetries = v
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user