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:
@@ -92,6 +92,16 @@ func (d *Database) migrate() error {
|
||||
}
|
||||
d.log.Info("database migrations completed")
|
||||
|
||||
// Data migration: merge "retry" target type into "http".
|
||||
// Previously there were two separate HTTP-based target types: "http"
|
||||
// (fire-and-forget) and "retry" (with retries). Now "http" handles
|
||||
// both: max_retries=0 means fire-and-forget, max_retries>0 enables
|
||||
// retries with exponential backoff and circuit breaker.
|
||||
if err := d.db.Exec("UPDATE targets SET type = 'http' WHERE type = 'retry'").Error; err != nil {
|
||||
d.log.Error("failed to migrate retry targets to http", "error", err)
|
||||
return err
|
||||
}
|
||||
|
||||
// Check if admin user exists
|
||||
var userCount int64
|
||||
if err := d.db.Model(&User{}).Count(&userCount).Error; err != nil {
|
||||
|
||||
@@ -5,7 +5,6 @@ type TargetType string
|
||||
|
||||
const (
|
||||
TargetTypeHTTP TargetType = "http"
|
||||
TargetTypeRetry TargetType = "retry"
|
||||
TargetTypeDatabase TargetType = "database"
|
||||
TargetTypeLog TargetType = "log"
|
||||
)
|
||||
@@ -22,7 +21,7 @@ type Target struct {
|
||||
// Configuration fields (JSON stored based on type)
|
||||
Config string `gorm:"type:text" json:"config"` // JSON configuration
|
||||
|
||||
// For retry targets
|
||||
// For HTTP targets (max_retries=0 means fire-and-forget, >0 enables retries with backoff)
|
||||
MaxRetries int `json:"max_retries,omitempty"`
|
||||
MaxQueueSize int `json:"max_queue_size,omitempty"`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user