mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Resolve lock in cloner if debugger is attached (#1075)
This commit is contained in:
parent
bb26db793a
commit
9a94f12e5f
@ -60,14 +60,15 @@ export class RecursiveCloner implements ICloner {
|
||||
if (typeOfObj === "object") {
|
||||
if (Array.isArray(obj)) {
|
||||
const objArr = obj as Array<T>;
|
||||
const clonedArray = await Promise.all(objArr.map(async (v) => await this.cloneAsync(v)));
|
||||
const clonedArray = await Promise.all(objArr.map((v) => this.cloneAsync(v)));
|
||||
return clonedArray as T;
|
||||
}
|
||||
|
||||
const newObj: Record<string, T> = {};
|
||||
const clonePromises = Object.keys(obj).map(async (key) => {
|
||||
const clonePromises = Object.keys(obj).map((key) => {
|
||||
const value = (obj as Record<string, T>)[key];
|
||||
newObj[key] = await this.cloneAsync(value);
|
||||
// Assign values to `newObj` with this.clone, assigning values to `newObj` causes locks with the debugger attached if cloneAsync is used.
|
||||
newObj[key] = this.clone(value);
|
||||
});
|
||||
|
||||
await Promise.all(clonePromises);
|
||||
|
Loading…
x
Reference in New Issue
Block a user