vlocode-project - v1.40.0-beta-4
    Preparing search index...

    Function preventParallel

    • Prevent a method from being executed in parallel by returning the same promise when the method is already executing.

      This can be useful when you have a method that is called multiple times in parallel and you want to prevent the method from being executed multiple times.

      Type Parameters

      • T extends (...args: TArgs[]) => Promise<TReturn>
      • TArgs = any
      • TReturn = any

      Parameters

      • OptionalvariableName: string | symbol

        Name of the variable to store the promise in. When not specified a unique variable name is generated.

      Returns MethodDecorator

      MethodDecorator

      This decorator is not meant for methods that are called in parallel with different arguments.