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'))
|
||||
.then(entries => Promise.all(
|
||||
entries
|
||||
.filter(entry => entry.isFile())
|
||||
.map(entry => entry.path)
|
||||
.filter(isOld)
|
||||
.map(fs.unlink)
|
||||
.filter(entry => entry.isFile() && isOld(entry.path))
|
||||
.map(entry => fs.unlink(entry.path))
|
||||
))
|
||||
.catch(err => {
|
||||
console.log("Error cleaning up failed QR scans:", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue