refactor: extract stat() out of cleanOldFailedPDF417Scans()

This commit is contained in:
siiky 2024-07-03 13:05:12 +01:00
parent 63f51f4f3e
commit 393e149b91

View file

@ -143,6 +143,8 @@ const readdirRec = rootPath =>
))
.then(_.flatten)
const stat = path => fs.stat(path).then(_.set('path', path))
// @see lib/customers.js:updateIdCardData()
const cleanOldFailedPDF417Scans = () => {
let old = new Date()
@ -156,7 +158,7 @@ const cleanOldFailedPDF417Scans = () => {
.then(entries => Promise.all(
entries
.filter(entry => entry.isFile())
.map(entry => fs.stat(entry.path).then(_.set('path', entry.path)))
.map(entry => stat(entry.path))
))
.then(filestats => Promise.all(
filestats