shortened urls cleanup
This commit is contained in:
parent
83289e13d9
commit
ef48da6478
@ -52,7 +52,16 @@ async function clearDatabase (config, dbPromise) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Database was cleared of %d files and %d IPFS hashes.', files.length, hashes.length)
|
// Shortened URLs
|
||||||
|
let shorts = await db.all('SELECT hash FROM Short WHERE timeat < ?', new Date() - (config.expiry * 1000))
|
||||||
|
if (shorts.length > 0) {
|
||||||
|
for (let i in shorts) {
|
||||||
|
await db.run('DELETE FROM Short WHERE hash = ?', shorts[i].hash)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Database was cleared of %d files, %d IPFS hashes and %d shortened URLs.',
|
||||||
|
files.length, hashes.length, shorts.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init () {
|
async function init () {
|
||||||
|
Loading…
Reference in New Issue
Block a user