Fix user export expiration
This commit is contained in:
parent
aac9ff8931
commit
ae3b487c42
|
@ -852,6 +852,7 @@ function runTest (withObjectStorage: boolean) {
|
||||||
|
|
||||||
await server.userExports.request({ userId: noahId, withVideoFiles: true })
|
await server.userExports.request({ userId: noahId, withVideoFiles: true })
|
||||||
await server.userExports.waitForCreation({ userId: noahId })
|
await server.userExports.waitForCreation({ userId: noahId })
|
||||||
|
await wait(1500)
|
||||||
|
|
||||||
const tomorrow = new Date()
|
const tomorrow = new Date()
|
||||||
tomorrow.setDate(tomorrow.getDate() + 1)
|
tomorrow.setDate(tomorrow.getDate() + 1)
|
||||||
|
@ -866,6 +867,13 @@ function runTest (withObjectStorage: boolean) {
|
||||||
|
|
||||||
await checkExportFileExists({ exists: true, server, userExport, withObjectStorage, redirectedUrl })
|
await checkExportFileExists({ exists: true, server, userExport, withObjectStorage, redirectedUrl })
|
||||||
|
|
||||||
|
// Should not delete the file
|
||||||
|
await server.debug.sendCommand({ body: { command: 'remove-expired-user-exports' } })
|
||||||
|
// File deletion
|
||||||
|
await wait(500)
|
||||||
|
|
||||||
|
await checkExportFileExists({ exists: true, server, userExport, withObjectStorage, redirectedUrl })
|
||||||
|
|
||||||
await server.config.updateExistingConfig({
|
await server.config.updateExistingConfig({
|
||||||
newConfig: {
|
newConfig: {
|
||||||
export: {
|
export: {
|
||||||
|
@ -876,11 +884,7 @@ function runTest (withObjectStorage: boolean) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await server.debug.sendCommand({
|
await server.debug.sendCommand({ body: { command: 'remove-expired-user-exports' } })
|
||||||
body: {
|
|
||||||
command: 'remove-expired-user-exports'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// File deletion
|
// File deletion
|
||||||
await wait(500)
|
await wait(500)
|
||||||
|
|
|
@ -109,7 +109,7 @@ export class UserExportModel extends SequelizeModel<UserExportModel> {
|
||||||
const query: FindOptions = {
|
const query: FindOptions = {
|
||||||
where: {
|
where: {
|
||||||
createdAt: {
|
createdAt: {
|
||||||
[Op.lt]: new Date(new Date().getTime() + expirationTimeMS)
|
[Op.lt]: new Date(new Date().getTime() - expirationTimeMS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue