mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
Remove hook timeout
This commit is contained in:
parent
0892e17f48
commit
dba3ab248f
@ -82,18 +82,7 @@ module.exports = function (strapi) {
|
|||||||
|
|
||||||
// Load a hook and initialize it.
|
// Load a hook and initialize it.
|
||||||
function loadHook(id, cb) {
|
function loadHook(id, cb) {
|
||||||
const timeoutInterval = 5000;
|
|
||||||
let hookTimeout;
|
|
||||||
|
|
||||||
hookTimeout = setTimeout(function tooLong() {
|
|
||||||
const hooksTookTooLongErr = 'The hook `' + id + '` is taking too long to load.';
|
|
||||||
const err = new Error(hooksTookTooLongErr);
|
|
||||||
err.code = 'E_HOOK_TIMEOUT';
|
|
||||||
cb(err);
|
|
||||||
}, timeoutInterval);
|
|
||||||
|
|
||||||
hooks[id].load(function (err) {
|
hooks[id].load(function (err) {
|
||||||
clearTimeout(hookTimeout);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
strapi.log.error('The hook `' + id + '` failed to load!');
|
strapi.log.error('The hook `' + id + '` failed to load!');
|
||||||
strapi.emit('hook:' + id + ':error');
|
strapi.emit('hook:' + id + ':error');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user