Permalink
Browse files

Whoops, collect garbage properly.

The previous code was off-by-one causing Lotte to hang in certain situations.
  • Loading branch information...
1 parent 6d41154 commit 5eae1c9a343f24b061236e354be7512fd5605f78 @StanAngeloff committed Dec 10, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/lotte.js
View
@@ -243,11 +243,11 @@ function cleanup(options, resume) {
if ( ! options.garbage) {
return resume();
}
- var remaining = options.garbage.length - 1;
+ var remaining = options.garbage.length;
options.garbage.forEach(function(temporary) {
fs.unlink(temporary, function() {
remaining = remaining - 1;
- if (remaining === 0) {
+ if (remaining <= 0) {
resume();
}
});

0 comments on commit 5eae1c9

Please sign in to comment.