mirror of https://github.com/Chocobozzz/PeerTube
Cleanup tmp directory at startup
parent
dae86118ed
commit
f4800714f9
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue