fix(netflow): отклонять конкурентный сброс до удаления данных
This commit is contained in:
1 parent
a575795ff5
commit
32b7812169
9 files changed
+63
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { deleteTrafficFlowData, executeTrafficFlowPurge } from "./traffic-flow-purge-execution.js"
|
||||
import { withTrafficFlowPurgeLock } from "../db/operation-lock.js"
|
||||
import { Worker } from "node:worker_threads"
|
||||
import { db, dbAll, pool, withAdvisoryLock } from "../db/index.js"
|
||||
import { db, dbAll, pool } from "../db/index.js"
|
||||
import { dropExpiredPartitions } from "../db/partitions.js"
|
||||
import { servers } from "../db/schema.js"
|
||||
import type { FlowPurgeDto, FlowStatsDto, FlowTalkerDto } from "@mmapp/contracts/traffic-flow"
|
||||
@@ -519,7 +520,7 @@ const PURGE_LOCK_KEY = 8_723_103
|
||||
|
||||
/** Удаляет данные одним transaction; ключи и пиры не меняются. */
|
||||
export async function purgeTrafficFlowStore(): Promise<FlowPurgeDto> {
|
||||
return withAdvisoryLock(PURGE_LOCK_KEY, () => executeTrafficFlowPurge({
|
||||
return withTrafficFlowPurgeLock(() => pool.connect(), PURGE_LOCK_KEY, () => executeTrafficFlowPurge({
|
||||
stop: async () => {
|
||||
wantListen = false
|
||||
await stopWorkerProcessAsync()
|
||||
|
||||
Reference in new issue
Block a user