Work on failed outbound requests and move type migrators

- DB type migrators are now in separate file, in preparation for full
  custom sql migration statements
- Start work on handling failed outbound requests stored in the db
This commit is contained in:
Melody Becker 2025-07-03 13:57:30 +02:00
parent 81a01fbf8b
commit 7ac4c628b8
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
13 changed files with 372 additions and 145 deletions

View file

@ -16,3 +16,17 @@ type FailedOutboundRequest struct {
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
}
type IFailedOutboundRequest interface {
// KillServers marks all servers where a request has more than X failed attempts as dead
//
// WITH servers_to_kill AS (
// SELECT target_server_id
// FROM failed_outbound_requests
// WHERE nr_of_attempts > @maxAttempts
// )
// UPDATE remote_servers
// SET is_dead = true
// WHERE id IN (SELECT target_server_id FROM servers_to_kill)
KillServers(maxAttempts uint32) error
}

View file

@ -12,6 +12,7 @@ type ServerMetadata struct {
UpdatedAt time.Time
// ---- Section TLS LetsEncrypt
LEDomain string
LECertUrl string
LECertStableUrl string
@ -21,4 +22,7 @@ type ServerMetadata struct {
LECSR []byte // Encrypted
LELastUpdate sql.NullTime
LEUserPrivKey []byte // Encrypted
// ---- Section Database
LastMigrationVersion uint64
}