Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit 7220adf

Browse files
Merge pull request #33 from Unity-Technologies/bugfix/cleanup-memory-optimizations
[PR] Optimize cleanup script's memory
2 parents accd3bd + ffb2cb7 commit 7220adf

File tree

2 files changed

+280
-228
lines changed

2 files changed

+280
-228
lines changed

lib/cache/cache_fs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const fs = require('fs-extra');
66
const uuid = require('uuid');
77
const consts = require('../constants');
88
const moment = require('moment');
9+
const pick = require('lodash').pick;
910

1011
class CacheFS extends CacheBase {
1112
constructor() {
@@ -131,6 +132,7 @@ class CacheFS extends CacheBase {
131132

132133
return helpers.readDir(self._cachePath, (item) => {
133134
if(item.stats.isDirectory()) return next();
135+
item = {path: item.path, stats: pick(item.stats, ['atime', 'size'])};
134136
allItems.push(item);
135137
cacheSize += item.stats.size;
136138
if(item.stats.atime < minFileAccessTime) {

0 commit comments

Comments
 (0)