refactor: merge retry target type into http (max_retries=0 = fire-and-forget)
All checks were successful
check / check (push) Successful in 1m46s

This commit is contained in:
clawbot
2026-03-01 23:51:55 -08:00
parent 4dd4dfa5eb
commit 25e27cc57f
7 changed files with 150 additions and 105 deletions

View File

@@ -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
}
}