stop using waitFor.abort() which is apparently not implemented

pull/1/head
Caleb James DeLisle 8 years ago
parent 2021bf6702
commit 5fe3ffabd1

@ -77,26 +77,29 @@ var getChannel = function (env, id, callback) {
} }
var path = mkPath(env, id); var path = mkPath(env, id);
var fileExists; var fileExists;
var errorState;
nThen(function (waitFor) { nThen(function (waitFor) {
checkPath(path, waitFor(function (err, exists) { checkPath(path, waitFor(function (err, exists) {
if (err) { if (err) {
waitFor.abort(); errorState = true;
complete(err); complete(err);
return; return;
} }
fileExists = exists; fileExists = exists;
})); }));
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
if (errorState) { return; }
if (!fileExists) { return; } if (!fileExists) { return; }
readMessages(path, function (msg) { readMessages(path, function (msg) {
channel.messages.push(msg); channel.messages.push(msg);
}, waitFor(function (err) { }, waitFor(function (err) {
if (err) { if (err) {
waitFor.abort(); errorState = true;
complete(err); complete(err);
} }
})); }));
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
if (errorState) { return; }
var stream = channel.writeStream = Fs.createWriteStream(path, { flags: 'a' }); var stream = channel.writeStream = Fs.createWriteStream(path, { flags: 'a' });
stream.on('open', waitFor()); stream.on('open', waitFor());
stream.on('error', function (err) { stream.on('error', function (err) {
@ -110,6 +113,7 @@ var getChannel = function (env, id, callback) {
} }
}); });
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
if (errorState) { return; }
complete(); complete();
}); });
}; };

Loading…
Cancel
Save