durable-execution - v0.7.0
    Preparing search index...

    Function createTransactionMutex

    • Create a transaction mutex. Use this to run DurableStorage.withTransaction in a durable storage sequentially. Only use this if the storage does not support running transactions in parallel.

      Returns TransactionMutex

      const mutex = createTransactionMutex()

      function createStorage() {
      return {
      withTransaction: async (fn) => {
      await mutex.acquire()
      try {
      // ... run transaction logic that won't run in parallel with other transactions
      } finally {
      mutex.release()
      }
      },
      }
      }