feat(task): put async storage in the global scope
This commit is contained in:
@@ -17,7 +17,10 @@ const PENDING = 'pending'
|
||||
const SUCCESS = 'success'
|
||||
exports.STATUS = { ABORTED, ABORTING, FAILURE, PENDING, SUCCESS }
|
||||
|
||||
const asyncStorage = new AsyncLocalStorage()
|
||||
// stored in the global context so that various versions of the library can interact.
|
||||
const asyncStorageKey = '@vates/task@0'
|
||||
const asyncStorage = global[asyncStorageKey] ?? (global[asyncStorageKey] = new AsyncLocalStorage())
|
||||
|
||||
const getTask = () => asyncStorage.getStore()
|
||||
|
||||
exports.Task = class Task {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
- @vates/diff minor
|
||||
- @vates/read-chunk patch
|
||||
- @vates/stream-reader minor
|
||||
- @vates/task patch
|
||||
- @vates/task minor
|
||||
- @xen-orchestra/backups minor
|
||||
- @xen-orchestra/mixins minor
|
||||
- vhd-lib minor
|
||||
|
||||
Reference in New Issue
Block a user