Skip to content

Commit

Permalink
[FIX] copy plugin array.
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Oct 20, 2014
1 parent ec581dc commit 86bbbbd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@
* @param {Function} next - callback to invoke after gathering application metrics
*/
return function monitor( request, response, next ) {
var metrics = {};
var pugs = plugins.slice(),
metrics = {};

// Run all monitor plugins...
(function next( error ) {
if ( error ) {
done( error );
return;
}
if ( plugins.length > 0 ) {
plugins.shift().apply( {}, [ metrics, next ] );
if ( pugs.length > 0 ) {
pugs.shift().apply( {}, [ metrics, next ] );
} else {
done();
}
Expand Down

0 comments on commit 86bbbbd

Please sign in to comment.