chore(): Improve workflows sdk tooling (#13421)
RESOLVES CORE-1171 **What** - Reduced async overhead for objects with mixed sync/async properties - Lower memory pressure from eliminated promise allocations - Faster primitive value processing with early returns - Better concurrency through selective batching of truly async operations - Event loop friendly behavior preventing artificial delays - Reduced memory allocation from eliminated duplicate processing - Decreased GC pressure from WeakMap-based caching instead of map **note** Now, `resolveValue`always treat every resoltion as sync operation unless it is not, meaning we do not create promise overhead when not necessary and only when actually treating with promises
This commit is contained in:
@@ -91,7 +91,7 @@ class DistributedTransaction extends EventEmitter {
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
#temporaryStorage = new Map<string, unknown>()
|
||||
#temporaryStorage = new WeakMap<{ key: string }, unknown>()
|
||||
|
||||
public static setStorage(storage: IDistributedTransactionStorage) {
|
||||
this.keyValueStore = storage
|
||||
@@ -312,15 +312,15 @@ class DistributedTransaction extends EventEmitter {
|
||||
}
|
||||
|
||||
public setTemporaryData(key: string, value: unknown) {
|
||||
this.#temporaryStorage.set(key, value)
|
||||
this.#temporaryStorage.set({ key }, value)
|
||||
}
|
||||
|
||||
public getTemporaryData(key: string) {
|
||||
return this.#temporaryStorage.get(key)
|
||||
return this.#temporaryStorage.get({ key })
|
||||
}
|
||||
|
||||
public hasTemporaryData(key: string) {
|
||||
return this.#temporaryStorage.has(key)
|
||||
return this.#temporaryStorage.has({ key })
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user