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.
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() } }, }} Copy
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() } }, }}
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.