From b4daae9b234cd72f955efb155ff14fb628bf5ce0 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 14 Nov 2014 16:02:30 -0500 Subject: [PATCH] closes #2307 --- src/plugins.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins.js b/src/plugins.js index b9741e1bec..310e35d8f5 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -453,7 +453,20 @@ var fs = require('fs'), function fireStaticHook(hook, hookList, params, callback) { async.each(hookList, function(hookObj, next) { if (typeof hookObj.method === 'function') { - hookObj.method(params, next); + var timedOut = false; + + var timeoutId = setTimeout(function() { + winston.warn('[plugins] Callback timed out, hook \'' + hook + '\' in plugin \'' + hookObj.id + '\''); + timedOut = true; + next(); + }, 5000); + + hookObj.method(params, function() { + clearTimeout(timeoutId); + if (!timedOut) { + next.apply(null, arguments); + } + }); } else { next(); }