senecajs / gate-executor Goto Github PK
View Code? Open in Web Editor NEWExecute functions that return via callback in order, but pause if a function is marked as a gate.
License: MIT License
Execute functions that return via callback in order, but pause if a function is marked as a gate.
License: MIT License
|
api_1 | [ Nodemon ][ Error ] Trace
api_1 | at GateExecutor.addListener (events.js:252:17)
api_1 | at GateExecutor.once (events.js:278:8)
api_1 | at Seneca.api_ready [as ready] (/var/app/current/api/node_modules/seneca/seneca.js:923:30)
api_1 | at meta.export (/var/app/current/api/node_modules/seneca-web/web.js:661:14)
api_1 | at Layer.handle [as handle_request] (/var/app/current/api/node_modules/express/lib/router/layer.js:95:5)
api_1 | at trim_prefix (/var/app/current/api/node_modules/express/lib/router/index.js:312:13)
api_1 | at /var/app/current/api/node_modules/express/lib/router/index.js:280:7
api_1 | at Function.process_params (/var/app/current/api/node_modules/express/lib/router/index.js:330:12)
api_1 | at next (/var/app/current/api/node_modules/express/lib/router/index.js:271:10)
api_1 | at SessionStrategy.strategy.pass (/var/app/current/api/node_modules/passport/lib/middleware/authenticate.js:325:9)
api_1 | at SessionStrategy.authenticate (/var/app/current/api/node_modules/passport/lib/strategies/session.js:71:10)
api_1 | at attempt (/var/app/current/api/node_modules/passport/lib/middleware/authenticate.js:348:16)
api_1 | at authenticate (/var/app/current/api/node_modules/passport/lib/middleware/authenticate.js:349:7)
api_1 | at Layer.handle [as handle_request] (/var/app/current/api/node_modules/express/lib/router/layer.js:95:5)
api_1 | at trim_prefix (/var/app/current/api/node_modules/express/lib/router/index.js:312:13)
api_1 | at /var/app/current/api/node_modules/express/lib/router/index.js:280:7
api_1 |
I believe this is GateExecutor adding listeners and not removing them
I was doing some tracing of an application, and I noted that there was a non-trivial amounts of calls to setImmediate being made in a misbehaving seneca application. It might be a simple but practical micro-optimization.
Also i recall needing to use a setImmediate library to deal with some strange browser compatibility issue in the past, so this might be good for cross-platform support.
at line:
https://github.com/senecajs/gate-executor/blob/master/gate-executor.js#L149
When the error of the error case you handle there is not actually an instance of Error, you will get a stacktrace from inside gate-executioner and no reference as to where the error originated inside your own code.
adding
if (!(err instanceof Error)) {
err = new Error(err);
}
will fix it.
I think the current timeout on the 'gate' should be disabled by default, and then we can enable this via an option in seneca if needed.
When gate-executor switched from jobs-specific setTimeouts to a generic setInterval a new bug has been introduced.
When the queue is empty the setInterval is cleared, but when a new job is added to the queue it isn't restarted.
This means that jobs added after the first "clear" will never fire a timeout.
Here's a PR with a test that exposes the bug: #15
This is the cause of the error reported in:
senecajs/seneca-amqp-transport#48
senecajs/seneca#517
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.