+ async lockFiles (videoUUID: string) {
+ if (!this.videoFileMutexStore.has(videoUUID)) {
+ this.videoFileMutexStore.set(videoUUID, new Mutex())
+ }
+
+ const mutex = this.videoFileMutexStore.get(videoUUID)
+ const releaser = await mutex.acquire()
+
+ logger.debug('Locked files of %s.', videoUUID, lTags(videoUUID))
+
+ return releaser
+ }
+
+ unlockFiles (videoUUID: string) {
+ const mutex = this.videoFileMutexStore.get(videoUUID)
+
+ mutex.release()
+
+ logger.debug('Released lockfiles of %s.', videoUUID, lTags(videoUUID))
+ }
+