mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 12:36:02 +01:00 
			
		
		
		
	closes #2307
This commit is contained in:
		@@ -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();
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user