Skip to content

Commit 7509233

Browse files
committed
pepper in some setImmediate for good measure. re #108
1 parent 38e4335 commit 7509233

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/core.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ Archiver.prototype._moduleAppend = function(source, data, callback) {
108108

109109
if (err) {
110110
this.emit('error', err);
111-
callback();
111+
setImmediate(callback);
112112
return;
113113
}
114114

115115
this.emit('entry', data);
116116
this._entries.push(data);
117117

118-
callback();
118+
setImmediate(callback);
119119
}.bind(this));
120120
};
121121

@@ -226,24 +226,24 @@ Archiver.prototype._onStatQueueTask = function(task, callback) {
226226

227227
fs.stat(task.filepath, function(err, stats) {
228228
if (this._state.aborted) {
229-
callback();
229+
setImmediate(callback);
230230
return;
231231
}
232232

233233
if (err) {
234234
this.emit('error', err);
235-
callback();
235+
setImmediate(callback);
236236
return;
237237
}
238238

239239
task = this._updateQueueTaskWithStats(task, stats);
240240

241241
if (task.source !== null) {
242242
this._queue.push(task);
243-
callback();
243+
setImmediate(callback);
244244
} else {
245245
this.emit('error', new Error('unsupported entry: ' + task.filepath));
246-
callback();
246+
setImmediate(callback);
247247
return;
248248
}
249249
}.bind(this));

0 commit comments

Comments
 (0)