fix(): Transform map (#13655)
**What** It seems that for some reason the weak map fail in some scenario, but after investigation, the usage of map would not have a bad impact as it will be released after the Distributed transaction if finished. Therefore, falling back to Map instead FIXES https://github.com/medusajs/medusa/issues/13654 NOTE: Waiting for the user feedback as he is also using node 18. We also use the exact same pattern in all our core flows without issues 🤔
This commit is contained in:
committed by
GitHub
parent
ea3d0100a9
commit
8734866eb1
@@ -91,7 +91,7 @@ class DistributedTransaction extends EventEmitter {
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
#temporaryStorage = new WeakMap<{ key: string }, unknown>()
|
||||
#temporaryStorage = new Map<string, unknown>()
|
||||
|
||||
public static setStorage(storage: IDistributedTransactionStorage) {
|
||||
this.keyValueStore = storage
|
||||
@@ -311,15 +311,15 @@ class DistributedTransaction extends EventEmitter {
|
||||
await DistributedTransaction.keyValueStore.clearStepTimeout(this, step)
|
||||
}
|
||||
|
||||
public setTemporaryData(key: { key: string }, value: unknown) {
|
||||
public setTemporaryData(key: string, value: unknown) {
|
||||
this.#temporaryStorage.set(key, value)
|
||||
}
|
||||
|
||||
public getTemporaryData(key: { key: string }) {
|
||||
public getTemporaryData(key: string) {
|
||||
return this.#temporaryStorage.get(key)
|
||||
}
|
||||
|
||||
public hasTemporaryData(key: { key: string }) {
|
||||
public hasTemporaryData(key: string) {
|
||||
return this.#temporaryStorage.has(key)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user