]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Cleanup tmp directory at startup
authorChocobozzz <me@florianbigard.com>
Tue, 19 Mar 2019 09:53:53 +0000 (10:53 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 19 Mar 2019 09:53:53 +0000 (10:53 +0100)
server/initializers/installer.ts
server/tests/api/users/users-multiple-servers.ts

index 349d7afb7a7f967798b744034836d1425e082870..cd2c942fd1dc2851136989782f72b0421138004c 100644 (file)
@@ -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)
 }
 
index 006d6cdf0e17da82d395e476bac0bb935620bd15..c46c2b7d72b5813993ed30cf6d9f7d64c4a92793 100644 (file)
@@ -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)
   })