aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/live/live-segment-sha-store.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/live/live-segment-sha-store.ts')
-rw-r--r--server/lib/live/live-segment-sha-store.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/lib/live/live-segment-sha-store.ts b/server/lib/live/live-segment-sha-store.ts
index 17e0c6a82..1a0a93985 100644
--- a/server/lib/live/live-segment-sha-store.ts
+++ b/server/lib/live/live-segment-sha-store.ts
@@ -1,4 +1,4 @@
1import { move, writeJson } from 'fs-extra' 1import { rename, writeJson } from 'fs-extra'
2import PQueue from 'p-queue' 2import PQueue from 'p-queue'
3import { basename } from 'path' 3import { basename } from 'path'
4import { mapToJSON } from '@server/helpers/core-utils' 4import { mapToJSON } from '@server/helpers/core-utils'
@@ -72,9 +72,9 @@ class LiveSegmentShaStore {
72 72
73 private writeToDisk () { 73 private writeToDisk () {
74 return this.writeQueue.add(async () => { 74 return this.writeQueue.add(async () => {
75 // Atomic write 75 // Atomic write: use rename instead of move that is not atomic
76 await writeJson(this.sha256PathTMP, mapToJSON(this.segmentsSha256)) 76 await writeJson(this.sha256PathTMP, mapToJSON(this.segmentsSha256))
77 await move(this.sha256PathTMP, this.sha256Path, { overwrite: true }) 77 await rename(this.sha256PathTMP, this.sha256Path)
78 78
79 if (this.sendToObjectStorage) { 79 if (this.sendToObjectStorage) {
80 const url = await storeHLSFileFromPath(this.streamingPlaylist, this.sha256Path) 80 const url = await storeHLSFileFromPath(this.streamingPlaylist, this.sha256Path)