This version is not covered by your current version range.
Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.
I recommend you look into these changes and try to get onto the latest version of actionhero.
Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.
Do you have any ideas how I could improve these pull requests? Did I report anything you think isn’t right?
Are you unsure about how things are supposed to work?
There is a collection of frequently asked questions and while I’m just a bot, there is a group of people who are happy to teach me new things. Let them know.
Removes "plugins" from tasks in favor of middleware, matching the rest of the ActionHero system.
Task middleware is implemented as a thin wrapper around Node Resque plugins and currently exposes the before_perform, after_perform, before_enqueue, and after_enqueue functions of Resque plugins through preProcessor, postProcessor, preEnqueue, and postEnqueue methods. Each middleware requires a name and at least one function. In addition, a middleware can be global, in which case it also requires a priority.
In the preProcessor, you can access the original task params through this.args[0].
In the postProcessor, you can access the task result at this.worker.result.
In the preEnqueue and postEnqueue you can access the task params through this.args[0]. - If you wish to prevent a task from being enqueued using the preEnqueue middleware you must explicitly set the toRun value to false in the callback. Because the task middleware is executed by Resque this is an instance of a Resque Worker and contains a number of other elements which may be useful in a middleware.
The following example is a simplistic implementation of a task execution timer middleware.
'use strict';
module.exports= {
loadPriority:1000,
initialize:function(api, next){
api.taskTimer= {
middleware: {
name:'timer',
global:true,
priority:90,
preProcessor:function(next){
var worker =this.worker;
worker.start=process.hrtime();
next();
},
postProcessor:function(next){
var worker =this.worker;
var elapsed =process.hrtime(worker.start);
var seconds = elapsed[0];
var millis = elapsed[1] /1000000;
api.log('Task '+worker.job.class+' finished in '+ seconds +' s and '+ millis +' ms.', 'info');
next();
},
preEnqueue:function(next){
var params =this.args[0];
//Validate paramsnext(null, true); //callback is in form cb(error, toRun)
},
postEnqueue:function(next){
api.log("Task successfully enqueued!");
next();
}
}
};
api.tasks.addMiddleware(api.taskTimer.middleware, function(error){
next(error);
});
}
};
Hello lovely humans,
actionhero just published its new version 15.0.0.
This version is not covered by your current version range.
Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.
I recommend you look into these changes and try to get onto the latest version of actionhero. Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.
Do you have any ideas how I could improve these pull requests? Did I report anything you think isn’t right? Are you unsure about how things are supposed to work?
There is a collection of frequently asked questions and while I’m just a bot, there is a group of people who are happy to teach me new things. Let them know.
Good luck with your project :sparkles:
You rock!
:palm_tree:
GitHub Release
Task Middleware
before_perform
,after_perform
,before_enqueue
, andafter_enqueue
functions of Resque plugins throughpreProcessor
,postProcessor
,preEnqueue
, andpostEnqueue
methods. Each middleware requires aname
and at least one function. In addition, a middleware can be global, in which case it also requires apriority
.preProcessor
, you can access the original taskparams
throughthis.args[0]
.postProcessor
, you can access the task result atthis.worker.result
.preEnqueue
andpostEnqueue
you can access the taskparams
throughthis.args[0]
. - If you wish to prevent a task from being enqueued using thepreEnqueue
middleware you must explicitly set thetoRun
value tofalse
in the callback. Because the task middleware is executed by Resquethis
is an instance of a Resque Worker and contains a number of other elements which may be useful in a middleware.Binary Commands
--startPriority
,--stopPriority
and--loadPriority
debug
status to quiet down ActionHero when starting up.The new version differs by 38 commits .
257080f
v15.0.0
247799c
Merge pull request #914 from evantahler/v15
fb514c5
upgrade docs
9db31b1
Merge pull request #913 from evantahler/binary
2173ce6
Merge branch 'master' into v15
3a86002
upgrade docs
f3a67fb
upgrade docs
744c25d
update locale string for test
2c1391a
upgrade generated package
1506f84
cleanup timer
7ca14f2
docs
d20c72a
better binary
8e07098
Merge branch 'v15' of github.com:evantahler/actionhero into v15
90b72fa
Merge pull request #905 from evantahler/greenkeeper-coveralls-2.11.12
331f771
Merge pull request #904 from gcoonrod/enqueueHooks
There are 38 commits in total. See the full diff.
This pull request was created by greenkeeper.io.
Tired of seeing this sponsor message? :zap:
greenkeeper upgrade