Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Cleanup tmp directory at startup

Chocobozzzf4800714f906
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts
index 349d7afb7a..cd2c942fd1 100644
--- a/server/initializers/installer.ts
+++ b/server/initializers/installer.ts
@@ -24,7 +24,7 @@ async function installApplication () {
}),
// Directories
- removeCacheDirectories()
+ removeCacheAndTmpDirectories()
.then(() => createDirectoriesIfNotExist())
])
} catch (err) {
@@ -41,7 +41,7 @@ export {
// ---------------------------------------------------------------------------
-function removeCacheDirectories () {
+function removeCacheAndTmpDirectories () {
const cacheDirectories = Object.keys(CACHE)
.map(k => CACHE[k].DIRECTORY)
@@ -53,6 +53,8 @@ function removeCacheDirectories () {
tasks.push(remove(dir))
}
+ tasks.push(remove(CONFIG.STORAGE.TMP_DIR))
+
return Promise.all(tasks)
}
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index 006d6cdf0e..c46c2b7d72 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -4,6 +4,7 @@ import * as chai from 'chai'
import 'mocha'
import { Account } from '../../../../shared/models/actors'
import {
+ checkTmpIsEmpty,
checkVideoFilesWereRemoved,
createUser,
doubleFollow,
@@ -216,6 +217,12 @@ describe('Test users with multiple servers', function () {
}
})
+ it('Should have an empty tmp directory', async function () {
+ for (const server of servers) {
+ await checkTmpIsEmpty(server)
+ }
+ })
+
after(async function () {
killallServers(servers)
})