| @@ -16,6 +16,7 @@ import ( | |||||
| ) | ) | ||||
| //check if has the object | //check if has the object | ||||
| //todo:修改查询方式 | |||||
| func ObsHasObject(path string) (bool, error) { | func ObsHasObject(path string) (bool, error) { | ||||
| hasObject := false | hasObject := false | ||||
| output, err := ObsCli.ListObjects(&obs.ListObjectsInput{Bucket:setting.Bucket}) | output, err := ObsCli.ListObjects(&obs.ListObjectsInput{Bucket:setting.Bucket}) | ||||
| @@ -25,6 +26,7 @@ func ObsHasObject(path string) (bool, error) { | |||||
| } | } | ||||
| for _, obj := range output.Contents { | for _, obj := range output.Contents { | ||||
| //obj.Key:attachment/0/1/019fd24e-4ef7-41cc-9f85-4a7b8504d958 | |||||
| if path == obj.Key { | if path == obj.Key { | ||||
| hasObject = true | hasObject = true | ||||
| break | break | ||||
| @@ -292,7 +292,7 @@ func AddAttachment(ctx *context.Context) { | |||||
| return | return | ||||
| } | } | ||||
| } else { | } else { | ||||
| has, err = storage.ObsHasObject(models.AttachmentRelativePath(uuid)) | |||||
| has, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(uuid)) | |||||
| if err != nil { | if err != nil { | ||||
| ctx.ServerError("ObsHasObject", err) | ctx.ServerError("ObsHasObject", err) | ||||
| return | return | ||||
| @@ -49,9 +49,8 @@ func ModelArtsIndex(ctx *context.Context) { | |||||
| return | return | ||||
| } | } | ||||
| timestamp := time.Now().Unix() | |||||
| for i, task := range ciTasks { | for i, task := range ciTasks { | ||||
| if task.Status == string(models.JobRunning) && (timestamp-int64(task.CreatedUnix) > 30) { | |||||
| if task.Status == string(models.JobRunning) { | |||||
| ciTasks[i].CanDebug = true | ciTasks[i].CanDebug = true | ||||
| } else { | } else { | ||||
| ciTasks[i].CanDebug = false | ciTasks[i].CanDebug = false | ||||