• 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) => Promise<TReturn>)

    • TArgs = any

    • TReturn = any

    Parameters

    • Optional variableName: string | symbol

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

    Returns MethodDecorator

    MethodDecorator

    Remarks

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