Compare commits
2 Commits
9de47fa5b8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e79afc8fa3 | |||
| 23b83cae39 |
@@ -45,7 +45,6 @@ func (c *cleaner) runOnce(ctx context.Context) {
|
||||
g.Log().Errorf(ctx, "[cleaner] list expired(downloaded) error: %v", err)
|
||||
} else {
|
||||
for _, t := range expired {
|
||||
_ = Storage.DeleteByTask(ctx, t)
|
||||
_ = dao.Task.HardDeleteByIDGlobal(ctx, t.Id)
|
||||
}
|
||||
g.Log().Infof(ctx, "[cleaner] expired(downloaded) cleaned, count=%d", len(expired))
|
||||
@@ -77,13 +76,12 @@ func (c *cleaner) runOnce(ctx context.Context) {
|
||||
g.Log().Infof(ctx, "[cleaner] failed retryable cleaned, count=%d", len(retryable))
|
||||
}
|
||||
|
||||
// 4) 超过重试次数仍失败(state=3)的任务:硬删除 + OSS
|
||||
// 4) 超过重试次数仍失败(state=3)的任务:硬删除
|
||||
exhausted, err := dao.Task.ListFailedExhaustedGlobal(ctx, 200)
|
||||
if err != nil {
|
||||
g.Log().Errorf(ctx, "[cleaner] list failed exhausted error: %v", err)
|
||||
} else {
|
||||
for _, t := range exhausted {
|
||||
_ = Storage.DeleteByTask(ctx, t)
|
||||
_ = dao.Task.HardDeleteByIDGlobal(ctx, t.Id)
|
||||
}
|
||||
g.Log().Infof(ctx, "[cleaner] failed exhausted cleaned, count=%d", len(exhausted))
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
// StorageService 结果存储(OSS/MinIO)抽象
|
||||
type StorageService interface {
|
||||
UploadByTask(ctx context.Context, t *entity.AsynchTask, data []byte, fileExt string, contentType string) (ossURL string, err error)
|
||||
DeleteByTask(ctx context.Context, t *entity.AsynchTask) error
|
||||
}
|
||||
|
||||
// Storage 默认存储实现(优先对接你们的 oss 文件服务;必要时也可以切到 MinIO)
|
||||
|
||||
@@ -68,13 +68,6 @@ func (s *ossStorage) UploadByTask(ctx context.Context, _ *entity.AsynchTask, dat
|
||||
return resp.FileURL, nil
|
||||
}
|
||||
|
||||
func (s *ossStorage) DeleteByTask(ctx context.Context, t *entity.AsynchTask) error {
|
||||
// 你说当前 oss 暂时没有删除接口:这里保留方法占位,后续补接口时直接实现
|
||||
_ = ctx
|
||||
_ = t
|
||||
return nil
|
||||
}
|
||||
|
||||
// setTaskHeadersToCtx 把任务入库时保存的 header 信息注入 ctx,给 worker 调 OSS 用
|
||||
func setTaskHeadersToCtx(ctx context.Context, headers map[string]string) context.Context {
|
||||
if headers == nil {
|
||||
|
||||
Reference in New Issue
Block a user