Cleanup tmp directory at startup
This commit is contained in:
parent
dae86118ed
commit
f4800714f9
2 changed files with 11 additions and 2 deletions
|
@ -24,7 +24,7 @@ async function installApplication () {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Directories
|
// Directories
|
||||||
removeCacheDirectories()
|
removeCacheAndTmpDirectories()
|
||||||
.then(() => createDirectoriesIfNotExist())
|
.then(() => createDirectoriesIfNotExist())
|
||||||
])
|
])
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -41,7 +41,7 @@ export {
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function removeCacheDirectories () {
|
function removeCacheAndTmpDirectories () {
|
||||||
const cacheDirectories = Object.keys(CACHE)
|
const cacheDirectories = Object.keys(CACHE)
|
||||||
.map(k => CACHE[k].DIRECTORY)
|
.map(k => CACHE[k].DIRECTORY)
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ function removeCacheDirectories () {
|
||||||
tasks.push(remove(dir))
|
tasks.push(remove(dir))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.push(remove(CONFIG.STORAGE.TMP_DIR))
|
||||||
|
|
||||||
return Promise.all(tasks)
|
return Promise.all(tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { Account } from '../../../../shared/models/actors'
|
import { Account } from '../../../../shared/models/actors'
|
||||||
import {
|
import {
|
||||||
|
checkTmpIsEmpty,
|
||||||
checkVideoFilesWereRemoved,
|
checkVideoFilesWereRemoved,
|
||||||
createUser,
|
createUser,
|
||||||
doubleFollow,
|
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 () {
|
after(async function () {
|
||||||
killallServers(servers)
|
killallServers(servers)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue