Skip to content

Node.js based forum software built for the modern web

closes #2307

barisusaklib4daae9b234c
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();
}