fix(aihr): sweep upload queue across tenants
This commit is contained in:
+2
-1
@@ -371,10 +371,11 @@ public class AihrUploadQueueService {
|
||||
private void sweepAndTrigger() {
|
||||
try {
|
||||
ensureTable();
|
||||
// Worker 清扫没有登录线程,必须跨租户处理卡死条目;领取与加工仍按条目租户隔离。
|
||||
int reset = jdbcTemplate.update("""
|
||||
update aihr_knowledge_upload_item
|
||||
set status = 0, update_time = now()
|
||||
where tenant_id = ? and status = 1
|
||||
where status = 1
|
||||
and (
|
||||
(update_time < (now() - interval %d minute) and file_name not regexp '\\\\.(mp4|mov|avi|mkv|webm|m4v)$')
|
||||
or update_time < (now() - interval %d minute)
|
||||
|
||||
+3
@@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@Tag("dev")
|
||||
@@ -23,5 +24,7 @@ class AihrUploadQueueServiceTest {
|
||||
assertTrue(code.contains("p.tenant_id = i.tenant_id"));
|
||||
assertTrue(code.contains("TenantHelper.dynamic(tenantId"));
|
||||
assertTrue(code.contains("new ItemRow(rs.getString(\"tenant_id\")"));
|
||||
assertTrue(code.contains("where status = 1\n and ("));
|
||||
assertFalse(code.contains("where tenant_id = ? and status = 1\n and ("));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user