@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.7.201",
3
+ "version": "1.7.202",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -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
- const fd = this.fd = openSync(lockFile, "wx", openMode);
68
- let n = 1;
69
- writeSync(fd, (n++) + "" );
70
- fdatasyncSync(fd);
66
+
67
+ writeFileSync(lockFile, "locked", { flag :"wx", flush: true });
68
+
71
69
  this.timer = setInterval(() => {
72
70
  try {
73
- writeSync(fd, (n++) + "" );
74
- fdatasyncSync(fd);
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...