Hermes MySQL
    Preparing search index...

    Function createMutex

    • A mutex on a named lock of MySQL (GET_LOCK), e.g. to run a scheduler on one instance of the application.

      The lock belongs to a connection of its own, which the mutex keeps open while it holds the lock: MySQL releases the lock when the connection closes, e.g. when the process dies. The lock lives only on the server it was taken on, so a failover of Aurora releases it: call Mutex.stillHeld before every piece of work and stop when it is false.

      GET_LOCK is reentrant, but the mutex is not: taking the lock again while holding it does nothing, so one unlock() releases it. An instance that does not hold the lock keeps its connection open between its attempts, until unlock().

      Parameters

      • params: { getOptions: () => PoolOptions; name: string; retryEvery?: Duration }

      Returns Mutex