From ddb683efb606f744cf49a203a8ff2f28a1221b94 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sat, 26 Dec 2020 13:27:52 -0700 Subject: [PATCH] Remove UploadID field from backups (#80) --- api/backup_endpoints.go | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/api/backup_endpoints.go b/api/backup_endpoints.go index 1809c19..982dad8 100644 --- a/api/backup_endpoints.go +++ b/api/backup_endpoints.go @@ -2,16 +2,10 @@ package api import ( "fmt" - "github.com/patrickmn/go-cache" "strconv" - "time" ) -// backupUploadIDs stores a cache of active S3 backups. -var backupUploadIDs = cache.New(time.Hour*3, time.Minute*5) - type BackupRemoteUploadResponse struct { - UploadID string `json:"upload_id"` Parts []string `json:"parts"` PartSize int64 `json:"part_size"` } @@ -32,16 +26,10 @@ func (r *Request) GetBackupRemoteUploadURLs(backup string, size int64) (*BackupR return nil, err } - // Store the backup upload id for later use, this is a janky way to be able to use it later with SendBackupStatus. - // Yes, the timeout of 3 hours is intentional, if this value is removed before the backup completes, - // the backup will fail even if it uploaded properly. - backupUploadIDs.Set(backup, res.UploadID, 0) - return &res, nil } type BackupRequest struct { - UploadID string `json:"upload_id"` Checksum string `json:"checksum"` ChecksumType string `json:"checksum_type"` Size int64 `json:"size"` @@ -51,11 +39,6 @@ type BackupRequest struct { // Notifies the panel that a specific backup has been completed and is now // available for a user to view and download. func (r *Request) SendBackupStatus(backup string, data BackupRequest) error { - // Set the UploadID on the data. - if v, ok := backupUploadIDs.Get(backup); ok { - data.UploadID = v.(string) - } - resp, err := r.Post(fmt.Sprintf("/backups/%s", backup), data) if err != nil { return err