-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execute queries in Fibers to support yielding APIs. #92
Execute queries in Fibers to support yielding APIs. #92
Conversation
I have to say: importing non-TypeScript npm packages into TypeScript is a huge pain. This PR took me 1.5 hours instead of ten minutes because of that nonsense. I don't know what I would have done without Visual Studio Code to ease some of the pain. |
@@ -32,7 +32,19 @@ export interface QueryOptions { | |||
formatResponse?: Function; | |||
} | |||
|
|||
// Make the global Promise constructor Fiber-aware. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to move these four lines either to the meteor-integration package or Meteor itself?
The Promise used by Meteor will already be Fiber-enabled, so calling makeCompatible in the tests is just simulating running in a Meteor environment.
Awesome! Really glad that Fibers didn't have to become a dependency for this to work. |
…ely. While originally introduced in #92 to accommodate Meteor, it seems that we're no longer making `Promise`s Fiber-aware using the `meteor-promise` library which leverages `fibers` under-the-hood. Since this package seems to be the sole reason that bootstrapping is failing on Node.js 12. To support Node.js 12, we could update to `fibers@4` which accommodates changes to the V8 API which have been made in recent Node.js versions, the `fibers@4` implementation is only compatible with Node.js 10 and 12 and is incompatible with Node.js 8, which we still actively support (though not for much longer!).
* Start running tests on Node.js v12. While not currently a so-called "Long-Term-Support" (LTS) release, Node.js v12 is on target to become LTS in October 2019 and Node.js 8 will end LTS earlier than previous even-numbered Node.js releases. See the Node.js schedule: https://github.com/nodejs/Release#release-schedule With that only a few months away, it's time to start getting a read on whether we're going to pass tests in that new engine. * Remove `meteor-promise` and `fibers`, which appear to be unused entirely. While originally introduced in #92 to accommodate Meteor, it seems that we're no longer making `Promise`s Fiber-aware using the `meteor-promise` library which leverages `fibers` under-the-hood. Since this package seems to be the sole reason that bootstrapping is failing on Node.js 12. To support Node.js 12, we could update to `fibers@4` which accommodates changes to the V8 API which have been made in recent Node.js versions, the `fibers@4` implementation is only compatible with Node.js 10 and 12 and is incompatible with Node.js 8, which we still actively support (though not for much longer!).
This change makes the global
Promise
constructor run all its.then
callbacks usingFiber
s drawn from a pool of recyclableFiber
objects. In other words, any code that runs during query evaluation can now call anyFiber
-based Meteor API.I removed the
"no-var-requires": true,
lint rule becauseimport Fiber = require('fibers')
is the only way to import theFiber
constructor.The
meteor-promise
npm package now has its own.d.ts
file to support this usage.