@social-mail/social-mail-web-server 1.7.201 → 1.7.202
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.
- package/dist/server/storage/LockFile.d.ts +0 -1
- package/dist/server/storage/LockFile.d.ts.map +1 -1
- package/dist/server/storage/LockFile.js +4 -8
- package/dist/server/storage/LockFile.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/server/storage/LockFile.ts +6 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { existsSync, mkdirSync, openSync, constants, writeSync, closeSync, unlinkSync, statSync, fdatasyncSync } from "node:fs";
|
|
3
|
+
import { existsSync, mkdirSync, openSync, constants, writeSync, closeSync, unlinkSync, statSync, fdatasyncSync, utimesSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import sleep from "../../common/sleep.js";
|
|
6
6
|
import { globalEnv } from "../../common/globalEnv.js";
|
|
@@ -61,17 +61,15 @@ export default class LockFile implements Disposable {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
timer: any;
|
|
64
|
-
fd: any;
|
|
65
64
|
|
|
66
65
|
constructor(private readonly lockFile) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
fdatasyncSync(fd);
|
|
66
|
+
|
|
67
|
+
writeFileSync(lockFile, "locked", { flag :"wx", flush: true });
|
|
68
|
+
|
|
71
69
|
this.timer = setInterval(() => {
|
|
72
70
|
try {
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
const now = new Date();
|
|
72
|
+
utimesSync(lockFile, now, now);
|
|
75
73
|
} catch {
|
|
76
74
|
// do nothing
|
|
77
75
|
}
|
|
@@ -81,7 +79,6 @@ export default class LockFile implements Disposable {
|
|
|
81
79
|
[Symbol.dispose]() {
|
|
82
80
|
try {
|
|
83
81
|
clearInterval(this.timer);
|
|
84
|
-
closeSync(this.fd);
|
|
85
82
|
unlinkSync(this.lockFile);
|
|
86
83
|
} catch (error) {
|
|
87
84
|
// ignore error...
|