1
Fork 0

Fix a dangling neo4j session

This commit is contained in:
viktorstrate 2019-08-11 15:18:28 +02:00
parent d72a65be53
commit 7bc29c3ec7
2 changed files with 13 additions and 3 deletions

View File

@ -69,6 +69,8 @@ export default async function processImage({ driver, markFinishedImage }, id) {
if (urlResult.records.length == 2) {
markFinishedImage()
session.close()
console.log('Skipping image', photo.path)
return
}
@ -80,8 +82,12 @@ export default async function processImage({ driver, markFinishedImage }, id) {
{ id }
)
await fs.remove(imagePath)
await fs.mkdirp(imagePath)
try {
await fs.remove(imagePath)
await fs.mkdirp(imagePath)
} catch (e) {
console.error('Could not remove old image, and make directory', e, e.stack)
}
let originalPath = photo.path

View File

@ -145,7 +145,11 @@ export default async function scanUser({ driver, scanAlbum }, user) {
)
for (const albumId of deletedAlbumIds) {
await fs.remove(getAlbumCachePath(albumId))
try {
await fs.remove(getAlbumCachePath(albumId))
} catch (e) {
console.error('Error while trying to delete album from cache', e, e.stack)
}
}
console.log(