mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-05 15:26:36 +08:00
fix(task): restore task metadata contract and type fields in task types api
This commit is contained in:
@@ -31,12 +31,16 @@ const (
|
||||
|
||||
// SystemCleanupMeta represents the task metadata.
|
||||
var SystemCleanupMeta = contracts.TaskMetaDTO{
|
||||
Name: SystemCleanupTask,
|
||||
DisplayName: "系统垃圾清理",
|
||||
Description: "定期清理未使用上传文件、历史推送记录和过期任务执行日志",
|
||||
Category: "maintenance",
|
||||
MaxRetry: 3,
|
||||
Queue: taskQueueDefault,
|
||||
Type: TaskTypeSystemCleanup,
|
||||
AsynqTask: SystemCleanupTask,
|
||||
Name: "系统垃圾清理",
|
||||
DisplayName: "系统垃圾清理",
|
||||
Description: "定期清理未使用上传文件、历史推送记录和过期任务执行日志",
|
||||
Category: "maintenance",
|
||||
SupportsTime: false,
|
||||
MaxRetry: 3,
|
||||
Queue: taskQueueDefault,
|
||||
Retryable: true,
|
||||
}
|
||||
|
||||
// SystemCleanupHandler 系统定期垃圾清理异步任务处理器
|
||||
|
||||
@@ -24,12 +24,16 @@ const (
|
||||
|
||||
// RebuildUploadStatsMeta describes the upload stats rebuild task.
|
||||
var RebuildUploadStatsMeta = contracts.TaskMetaDTO{
|
||||
Name: RebuildUploadStatsTask,
|
||||
DisplayName: "重算文件存储统计",
|
||||
Description: "根据当前 w_uploads 活跃记录全量重建 w_upload_stats(总量、类型、分类、趋势)",
|
||||
Category: taskCategoryUpload,
|
||||
MaxRetry: 3,
|
||||
Queue: taskQueueDefault,
|
||||
Type: TaskTypeRebuildUploadStats,
|
||||
AsynqTask: RebuildUploadStatsTask,
|
||||
Name: "重算文件存储统计",
|
||||
DisplayName: "重算文件存储统计",
|
||||
Description: "根据当前 w_uploads 活跃记录全量重建 w_upload_stats(总量、类型、分类、趋势)",
|
||||
Category: taskCategoryUpload,
|
||||
SupportsTime: false,
|
||||
MaxRetry: 2,
|
||||
Queue: taskQueueDefault,
|
||||
Retryable: true,
|
||||
}
|
||||
|
||||
// RebuildUploadStatsHandler rebuilds incremental upload stats from active upload records.
|
||||
|
||||
@@ -36,31 +36,25 @@ const (
|
||||
|
||||
// StorageMigrationMeta describes the manually dispatchable migration task.
|
||||
var StorageMigrationMeta = contracts.TaskMetaDTO{
|
||||
Name: StorageMigrationTask,
|
||||
DisplayName: "迁移文件存储",
|
||||
Description: "将活动存储中的文件迁移到待切换的目标存储,迁移期间文件系统保持只读",
|
||||
Category: taskCategoryUpload,
|
||||
MaxRetry: 3,
|
||||
Queue: taskQueueDefault,
|
||||
Type: TaskTypeStorageMigration,
|
||||
AsynqTask: StorageMigrationTask,
|
||||
Name: "迁移文件存储",
|
||||
DisplayName: "迁移文件存储",
|
||||
Description: "将活动存储中的文件迁移到待切换的目标存储,迁移期间文件系统保持只读",
|
||||
Category: taskCategoryUpload,
|
||||
SupportsTime: false,
|
||||
MaxRetry: 1,
|
||||
Queue: taskQueueDefault,
|
||||
Retryable: true,
|
||||
Params: []contracts.TaskParamDTO{
|
||||
{
|
||||
Name: "target",
|
||||
Label: "目标存储配置 (JSON)",
|
||||
Type: "text",
|
||||
Required: true,
|
||||
Placeholder: `{"driver": "s3", "local": {"root": "."}, "s3": {"bucket": "my-bucket"}}`,
|
||||
Description: "待迁移到的目标存储引擎完整配置 JSON 字符串",
|
||||
},
|
||||
{
|
||||
Name: "batch_size",
|
||||
Type: "number",
|
||||
Required: false,
|
||||
Description: "每批扫描的文件数量(默认 100)",
|
||||
},
|
||||
{
|
||||
Name: "concurrency",
|
||||
Type: "number",
|
||||
Required: false,
|
||||
Description: "并发迁移 worker 数量(默认 4)",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -34,17 +34,23 @@ var warmImageCacheMu sync.Mutex
|
||||
|
||||
// WarmImageCacheMeta represents the image cache warmup task metadata.
|
||||
var WarmImageCacheMeta = contracts.TaskMetaDTO{
|
||||
Name: WarmImageCacheTask,
|
||||
DisplayName: "预热图片压缩缓存",
|
||||
Description: "串行将文件管理中的图片转换为指定质量的 WebP 并写入永久缓存",
|
||||
Category: taskCategoryUpload,
|
||||
MaxRetry: 3,
|
||||
Queue: taskQueueDefault,
|
||||
Type: TaskTypeWarmImageCache,
|
||||
AsynqTask: WarmImageCacheTask,
|
||||
Name: "预热图片压缩缓存",
|
||||
DisplayName: "预热图片压缩缓存",
|
||||
Description: "串行将文件管理中的图片转换为指定质量的 WebP 并写入永久缓存",
|
||||
Category: taskCategoryUpload,
|
||||
SupportsTime: false,
|
||||
MaxRetry: 1,
|
||||
Queue: taskQueueDefault,
|
||||
Retryable: true,
|
||||
Params: []contracts.TaskParamDTO{
|
||||
{
|
||||
Name: "quality",
|
||||
Label: "图片质量",
|
||||
Type: "string",
|
||||
Required: true,
|
||||
Placeholder: "low / medium / high",
|
||||
Description: "WebP 压缩质量,仅支持 low、medium、high",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user