mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-18 07:53:04 +00:00
Add Retry
button when creating a mirror-repo fails (#26228)
fixed #26156 * Added a retry button in the frontend (only displayed when the status is abnormal) * After clicking Retry, the backend adds the task back to the task queue   --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
907bedaad0
commit
865d2221c0
6 changed files with 57 additions and 4 deletions
|
@ -126,3 +126,27 @@ func CreateMigrateTask(doer, u *user_model.User, opts base.MigrateOptions) (*adm
|
|||
|
||||
return task, nil
|
||||
}
|
||||
|
||||
// RetryMigrateTask retry a migrate task
|
||||
func RetryMigrateTask(repoID int64) error {
|
||||
migratingTask, err := admin_model.GetMigratingTask(repoID)
|
||||
if err != nil {
|
||||
log.Error("GetMigratingTask: %v", err)
|
||||
return err
|
||||
}
|
||||
if migratingTask.Status == structs.TaskStatusQueued || migratingTask.Status == structs.TaskStatusRunning {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO Need to removing the storage/database garbage brought by the failed task
|
||||
|
||||
// Reset task status and messages
|
||||
migratingTask.Status = structs.TaskStatusQueued
|
||||
migratingTask.Message = ""
|
||||
if err = migratingTask.UpdateCols("status", "message"); err != nil {
|
||||
log.Error("task.UpdateCols failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return taskQueue.Push(migratingTask)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue