Skip to content

Commit

Permalink
allow defining an id in backup job
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Sep 2, 2024
1 parent d043faa commit 0643f8c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions web/backupjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const (
)

type CreateBackupJob struct {
ID string `json:"id"`
Type BackupJobType `json:"type"`
Host string `json:"host"`
Port int `json:"port"`
Expand Down Expand Up @@ -110,12 +111,15 @@ func (a *Api) CreateBackupJob(w http.ResponseWriter, r *http.Request, c *types.C
return
}

id := uuid.NewString()
if job.ID == "" {
job.ID = uuid.NewString()
}

info := &BackupJobInfo{
Status: BackupJobRunning,
ID: id,
ID: job.ID,
}
backupjobs[id] = info
backupjobs[job.ID] = info
go backupJob(a.app, job, info, c)

SendJson(w, info)
Expand Down

0 comments on commit 0643f8c

Please sign in to comment.