Store failed requests in db for later retries

This commit is contained in:
Melody Becker 2025-06-13 13:43:27 +02:00
parent d86ad370df
commit 1c216e415d
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
8 changed files with 1292 additions and 250 deletions

View file

@ -0,0 +1,18 @@
package models
import "time"
// Stores an outbound request that hasn't successfully resolved yet
type FailedOutboundRequest struct {
Id uint64 `gorm:"primarykey"`
RawData []byte // The body data of the request
Target string // The url to send the data to (via post)
FirstAttempt time.Time // When the first attempt was started
LastAttempt time.Time // When the latest attempt was started
ActingUser *User // The user on who's behalf the request is being performed
ActingUserId string // Id of the acting user
NrOfAttempts uint32 // How often the request was attempted already
LastFailureReason string // The reason why the last attempt failed (actually a FailedOutboundRequestReason)
TargetServer *RemoteServer // The remote server being targeted. Included to determine if a request still has a chance of success
TargetServerId uint // Id of the target remote server
}