appback-remoteagent 0.13.17 → 0.13.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
3
4
|
const DEFAULT_STATE = {
|
|
4
5
|
version: 1,
|
|
5
6
|
updatedAt: "",
|
|
@@ -128,7 +129,7 @@ export class BotPollingStateService {
|
|
|
128
129
|
async writeNow() {
|
|
129
130
|
const state = await this.read();
|
|
130
131
|
state.updatedAt = new Date().toISOString();
|
|
131
|
-
const tmpPath = `${this.filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
132
|
+
const tmpPath = `${this.filePath}.${process.pid}.${Date.now()}.${randomUUID()}.tmp`;
|
|
132
133
|
this.writeInFlight = this.writeInFlight.then(async () => {
|
|
133
134
|
await fs.mkdir(path.dirname(this.filePath), { recursive: true });
|
|
134
135
|
await fs.writeFile(tmpPath, `${JSON.stringify(state, null, 2)}\n`, "utf8");
|