node-fibers

Returning a value from inside Fibers(nodejs)

夙愿已清 提交于 2021-02-08 10:35:53
问题 So i'm having trouble trying to return a value from the constructor of this module. I literally have no idea how to return a value back to the constructor. I hope the code is self-explanatory, i want the constructor to return the hash variable. var Fiber = require('fibers'); var Future = require('fibers/future'), wait = Future.wait; var fs = require('fs') var crypto = require('crypto') exports.cryptFile = function(fileName, callback){ var crypt = crypto.createHash('md5'); var stream = fs

Reinstalling node-fibers for a Meteor app on Modulus.io?

浪尽此生 提交于 2020-01-14 06:44:08
问题 I'm trying to port a Meteor application from Heroku to Modulus.io (hopefully will be able to test out sticky sessions and horizontal scaling). I've demeteorized my app using the Modulus.io script, as spelled out in the following articles and repositories. https://github.com/onmodulus/demeteorizer http://blog.modulus.io/demeteorizer After demeteorizing, I zipped and uploaded, and got an empty deploy log and a white screen in the browser. After a bit more research, I deleted the node_modules

Reinstalling node-fibers for a Meteor app on Modulus.io?

折月煮酒 提交于 2020-01-14 06:44:08
问题 I'm trying to port a Meteor application from Heroku to Modulus.io (hopefully will be able to test out sticky sessions and horizontal scaling). I've demeteorized my app using the Modulus.io script, as spelled out in the following articles and repositories. https://github.com/onmodulus/demeteorizer http://blog.modulus.io/demeteorizer After demeteorizing, I zipped and uploaded, and got an empty deploy log and a white screen in the browser. After a bit more research, I deleted the node_modules

Meteor.Collection with Meteor.bindEnvironment

你。 提交于 2019-12-24 04:24:08
问题 Within a function that is already within Meteor.binEnvironment, when I run <collection>.find ({}) , I get the error throw new Error ('Can \' t wait without a fiber '); If you place that call also within Meteor.bindEnvironment(<collection>.find ({})) , the error message becomes: throw new Error (noFiberMessage); The function in question runs through Meteor.methods ({}) Where am I going wrong? Example to reproduce the error: Meteor.methods({ "teste" : Meteor.bindEnvironment(function(){ var

Tracking down stack overflow in meteor/node fiber

大兔子大兔子 提交于 2019-12-23 09:38:45
问题 I'm seeing this crash now and am not familiar enough with the node fiber infrastructure to know where to begin interpreting the error or instrumenting the code... Meteor server running on: http://localhost:3000/ W202407-10:06:05.740(-8)? (STDERR) /Users/dauser/.meteor/tools/0b2f28e18b/lib/node_modules/fibers/future.js:173 W202407-10:06:07.363(-8)? (STDERR) throw(ex); W202407-10:06:07.363(-8)? (STDERR) ^ W202407-10:06:07.363(-8)? (STDERR) RangeError: Maximum call stack size exceeded => Exited

Why does ESLint trigger lint errors on while(true) using fibers?

一个人想着一个人 提交于 2019-12-23 07:37:26
问题 I have come JS code with some infinite loops (we're using node-fibers to allow things to happen). ESLint hates: while (true) { } because of the constant condition. The following is allowed though: for(;;) { } Beyond just feeding the lintbeast, are there any objective reasons to favour for over while (or vice versa)? NOTE : This question is explicitly requesting objective reasons and so is not simply opinion based. 回答1: These rules about infinite loops are from before generators were a thing

'Meteor code must always run within a Fiber' error when using NPM package

≡放荡痞女 提交于 2019-12-22 10:15:41
问题 I'm using Meteor.require('npmPackage') to use a NPM package. However I seem to be getting an error when writing to mongo in npm package's callback function. Error: Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment. Code npmPackage.getInfo(function(err, data) { UserSession.insert({ key: 'info', value: data }); console.log(data); }); I tried wrapping the code within Fiber but the same error message is

How to call async method from Meteor own callbacks?

左心房为你撑大大i 提交于 2019-12-21 05:18:14
问题 I've just spent a few hours reading SO with answers such as Meteor: Calling an asynchronous function inside a Meteor.method and returning the result Unfortunately, I still didn't manage to user fibers, or futures for that matter. I'm trying to do something fairly simple (I think!). When creating a user, add a variable to the user object, based on the result of an asynchronous method. So imagine if you will my async method is called on a 3rd party db server called BANK, which could take

Meteor wrapAsync or bindEnvironment without standard callback signature

梦想的初衷 提交于 2019-12-20 04:59:07
问题 I'm trying to call createTableIfNotExists in this npm package, and do so synchronously in Meteor, server-side. https://www.npmjs.com/package/azure-storage However, the callback signature is of type function(error, result, response) instead of the traditional function(error,result) . 1) Because of that, I cannot use Meteor.wrapAsync and instead have to use Meteor.bindEnvironment 2) I call 'bindEnvironment' as below. Note the callback with 3 arguments. This works, but now I would like to

_meteor_bootstrap_.require not working in Meteor 0.6.4.1

百般思念 提交于 2019-12-13 04:32:48
问题 The code I inherited use _meteor_bootstrap.require, an internal meteor details, to load module. Look like it's no longer working with 0.6.4.1? any suggestions of how I should load modules? Current code require = meteor_bootstrap.require Future = require (fibers/future) The error message I got: C:\Program Files (x86)\Meteor\lib\node_modules\fibers\future.js:173 throw(ex); ^ TypeError: undefined is not a function at app/server/main.coffee.js:7:10 at C:\Users\jhuang\Documents\Tervela\5.0.16\i32