こんにちは、私は以下のようにMeteorでproxy-verifier NPMパッケージを使用しようとしています:
import ProxyVerifier from 'proxy-verifier';
// this is my method call on server startup
Jobs.find().forEach((job) => {
Meteor.call("checkProxy", job.proxy, (error, result) => {
if (error) {
console.log("error: " + error);
} else {
console.log("result: " + result); // result is true or false
let inc;
inc = result ? 1 : -1;
Jobs.update({
_id: job._id
}, {
$inc: {
count: inc
}
});
}
});
});
// this is my method
checkProxy(proxy) {
this.unblock();
let syncTestProtocol = Meteor.wrapAsync(ProxyVerifier.testProtocol);
let testResult;
try {
testResult = syncTestProtocol(proxy);
return testResult.ok;
} catch (error) {
return false;
}
}
それはうまく機能しますが、時々(おそらくいくつかのプロキシをチェックすると)例外の下に戻ります:
I20160724-07:48:18.391(4.5)? Exception in callback of async function: Error: Future resolved more than once
I20160724-07:48:18.391(4.5)? at Object.Future.return (/home/username/.meteor/packages/meteor-tool/.1.3.5_1.emd1tx++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:261:10)
I20160724-07:48:18.391(4.5)? at Object.<anonymous> (/home/username/.meteor/packages/meteor-tool/.1.3.5_1.emd1tx++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:349:16)
I20160724-07:48:18.391(4.5)? at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1)
I20160724-07:48:18.392(4.5)? Exception in callback of async function: Error: Future resolved more than once
I20160724-07:48:18.392(4.5)? at Object.Future.return (/home/username/.meteor/packages/meteor-tool/.1.3.5_1.emd1tx++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:261:10)
I20160724-07:48:18.393(4.5)? at Object.<anonymous> (/home/username/.meteor/packages/meteor-tool/.1.3.5_1.emd1tx++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:349:16)
I20160724-07:48:18.393(4.5)? at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1)
メソッドで使用Meteor.wrapAsync
しましたcheckProxy
が、これに関連していますか?この問題を見つけて修正する方法を教えてください。