refactor: reduce number of intermediate arrays
This commit is contained in:
parent
1451f78211
commit
7ab44602ee
1 changed files with 2 additions and 4 deletions
|
|
@ -195,10 +195,8 @@ const cleanOldFailedQRScans = () => {
|
||||||
readdirRec(path.join(OPERATOR_DATA_DIR, 'failedQRScans'))
|
readdirRec(path.join(OPERATOR_DATA_DIR, 'failedQRScans'))
|
||||||
.then(entries => Promise.all(
|
.then(entries => Promise.all(
|
||||||
entries
|
entries
|
||||||
.filter(entry => entry.isFile())
|
.filter(entry => entry.isFile() && isOld(entry.path))
|
||||||
.map(entry => entry.path)
|
.map(entry => fs.unlink(entry.path))
|
||||||
.filter(isOld)
|
|
||||||
.map(fs.unlink)
|
|
||||||
))
|
))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log("Error cleaning up failed QR scans:", err)
|
console.log("Error cleaning up failed QR scans:", err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue