fix(xo-server): enable async_hooks support in Bluebird (#5635)

Necessary for `@xen-orchestra/backups`.
This commit is contained in:
badrAZ 2021-03-02 13:22:47 +01:00 committed by GitHub
parent deb58e40d5
commit 1ff25943dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,14 @@ try {
// Use Bluebird for all promises as it provides better performance and
// less memory usage.
global.Promise = require('bluebird')
const Bluebird = require('bluebird')
// Enable `async_hooks` because it's used by `@xen-orchestra/backups/Task` via `node-zone`
//
// See: http://bluebirdjs.com/docs/api/promise.config.html#async-hooks
Bluebird.config({ asyncHooks: true })
global.Promise = Bluebird
require('@xen-orchestra/log/configure').catchGlobalErrors(require('@xen-orchestra/log').default('xo:xo-server'))