fix(weknora): 上传带上已发现的 X-Tenant-ID,TENANT_REQUIRED 不再误判为去重冲突
平台级 Key 访问 0.9 的租户资源需要 X-Tenant-ID。GET 调用会在 409 后发现并重放, 但 multipart 上传既没有带上这个头、也无法重放请求体,于是每次上传都拿到 409 TENANT_REQUIRED,再被 handler 当成「已存在的同一份文件」去认领,最终 test.upload 连续失败、publication 停在 pending/uploading。 - UploadFile 复用 BeginTask 已发现的 workspace 头; - 上传的 409 若携带 TENANT_REQUIRED,按普通 409 失败处理,不再返回 ErrConflict; - test.upload 重试耗尽时把 publication 标为 failed,重试入口不再永远 409。
This commit is contained in:
@@ -128,6 +128,21 @@ SET publication_id = EXCLUDED.publication_id,
|
||||
resolution_reason = '',
|
||||
created_at = EXCLUDED.created_at
|
||||
RETURNING job_id
|
||||
), parked_publication AS (
|
||||
-- 上传重试耗尽时把对账面同步成失败:否则 publication 停在
|
||||
-- pending/uploading,重试入口(要求 failed/stalled)永远 409,
|
||||
-- 页面上的「重试」看起来点了没反应。
|
||||
UPDATE test_publications p
|
||||
SET ingest_state = CASE WHEN p.ingest_state = 'uploading' THEN 'failed' ELSE p.ingest_state END,
|
||||
processing_state = 'failed',
|
||||
last_error = $3,
|
||||
updated_at = $4
|
||||
FROM updated
|
||||
WHERE updated.state = 'failed'
|
||||
AND updated.type = 'test.upload'
|
||||
AND updated.payload->>'publication_id' = p.id
|
||||
AND p.knowledge_id = ''
|
||||
RETURNING p.id
|
||||
)
|
||||
SELECT id FROM updated
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user