Moeen Chat Service - v1.0.0
    Preparing search index...

    Implements

    • OnApplicationShutdown
    Index

    Constructors

    Properties

    LOCK_TTL_SEC: number = 3000
    lockedChats: Set<string> = ...
    logger: Logger = ...

    Methods

    • Parameters

      • chatId: string

      Returns Promise<boolean>

    • Parameters

      • chatId: string

      Returns string

    • Attempts to acquire a distributed lock for the specified chat using Redis.

      This method sets a lock key in Redis with a time-to-live (TTL) to prevent concurrent operations on the same chat. If the lock is already held, it returns false and logs a warning. If the lock is successfully acquired, it returns true. In case of Redis errors, it logs the error and returns false.

      Parameters

      • chatId: string

        The unique identifier of the chat to lock.

      Returns Promise<boolean>

      A promise that resolves to true if the lock was acquired, or false otherwise.

    • Returns Promise<void>

    • Parameters

      • chatId: string

      Returns Promise<void>