mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Fix ssh-tunnel reconnect problem by keeping reference to Fiber we want to yield to.
For more info look here: https://github.com/laverdet/node-fibers/issues/131
This commit is contained in:
@@ -3,6 +3,7 @@ var files = require('./files.js');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var unipackage = require('./unipackage.js');
|
||||
var fiberHelpers = require('./fiber-helpers.js');
|
||||
var Fiber = require('fibers');
|
||||
var request = require('request');
|
||||
|
||||
@@ -232,11 +233,7 @@ exports.logs = function (options) {
|
||||
galaxy.close();
|
||||
}
|
||||
|
||||
// XXX: should not be global, quick hack to force logs continuation work after
|
||||
// reconnect. Since ssh-tunnel reconnect forces this method to rerun we need
|
||||
// to preserve some global state.
|
||||
if (typeof lastLogId === "undefined")
|
||||
lastLogId = null;
|
||||
var lastLogId = null;
|
||||
var logReader = getMeteor(options.context).connect(logReaderURL);
|
||||
var Log = unipackage.load({
|
||||
library: options.context.library,
|
||||
@@ -278,7 +275,7 @@ exports.logs = function (options) {
|
||||
// (otherwise Node will continue running).
|
||||
logReader.close();
|
||||
} else {
|
||||
Fiber.yield();
|
||||
fiberHelpers.yieldForever();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -37,3 +37,11 @@ exports.parallelEach = function (collection, callback, context) {
|
||||
// Throw if any threw.
|
||||
_.each(futures, function (f) { f.get(); });
|
||||
};
|
||||
|
||||
// https://github.com/laverdet/node-fibers/issues/131
|
||||
var fibersYieldForever = [];
|
||||
exports.yieldForever = function () {
|
||||
fibersYieldForever.push(Fiber.current);
|
||||
Fiber.yield();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user