+ public static async runExclusive<T>(type: AsyncLockType, fn: () => T | Promise<T>): Promise<T> {
+ return AsyncLock.acquire(type)
+ .then(fn)
+ .finally(() => {
+ AsyncLock.release(type).catch(Constants.EMPTY_FUNCTION);
+ });
+ }
+
+ private static async acquire(type: AsyncLockType): Promise<void> {