Able to analyze right now

This commit is contained in:
LittleSheep 2024-12-26 22:55:16 +08:00
parent 790b123410
commit 044b0eefca
2 changed files with 13 additions and 3 deletions

View File

@ -66,7 +66,12 @@ func createAttachmentDirectly(c *fiber.Ctx) error {
tx.Commit() tx.Commit()
metadata.Pool = &pool metadata.Pool = &pool
if !c.QueryBool("analyzeNow", false) {
services.AnalyzeAttachment(metadata)
} else {
services.PublishAnalyzeTask(metadata) services.PublishAnalyzeTask(metadata)
}
return c.JSON(metadata) return c.JSON(metadata)
} }

View File

@ -113,9 +113,14 @@ func uploadAttachmentMultipart(c *fiber.Ctx) error {
return c.JSON(meta) return c.JSON(meta)
} }
if meta, err = services.MergeFileChunks(meta, chunkArrange); err != nil { meta, err = services.MergeFileChunks(meta, chunkArrange)
if err != nil {
return fiber.NewError(fiber.StatusInternalServerError, err.Error()) return fiber.NewError(fiber.StatusInternalServerError, err.Error())
} else if !c.QueryBool("analyzeNow", false) {
services.AnalyzeAttachment(meta)
} else { } else {
services.PublishAnalyzeTask(meta)
}
return c.JSON(meta) return c.JSON(meta)
} }
}