Lint
This commit is contained in:
parent
8adb8841ef
commit
a5e128efcd
2 changed files with 7 additions and 14 deletions
|
|
@ -199,14 +199,14 @@ export class MockAgent extends MockClient {
|
||||||
);
|
);
|
||||||
this.client.logger.info(
|
this.client.logger.info(
|
||||||
"Local files: " +
|
"Local files: " +
|
||||||
Array.from(otherAgent.localFiles.keys()).join(", ")
|
Array.from(otherAgent.localFiles.keys()).join(", ")
|
||||||
);
|
);
|
||||||
otherAgent.client.logger.info(
|
otherAgent.client.logger.info(
|
||||||
"Local data: " + JSON.stringify(otherAgent.data, null, 2)
|
"Local data: " + JSON.stringify(otherAgent.data, null, 2)
|
||||||
);
|
);
|
||||||
otherAgent.client.logger.info(
|
otherAgent.client.logger.info(
|
||||||
"Local files: " +
|
"Local files: " +
|
||||||
Array.from(otherAgent.localFiles.keys()).join(", ")
|
Array.from(otherAgent.localFiles.keys()).join(", ")
|
||||||
);
|
);
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export async function withTimeout<T>(
|
export async function withTimeout<T>(
|
||||||
promise: Promise<T>,
|
promise: Promise<T>,
|
||||||
timeoutMs: number,
|
timeoutMs: number,
|
||||||
|
|
@ -7,17 +6,11 @@ export async function withTimeout<T>(
|
||||||
return Promise.race([
|
return Promise.race([
|
||||||
promise,
|
promise,
|
||||||
new Promise<T>((_, reject) =>
|
new Promise<T>((_, reject) =>
|
||||||
setTimeout(
|
setTimeout(() => {
|
||||||
() =>
|
reject(
|
||||||
{ reject(
|
new Error(`${operationName} timed out after ${timeoutMs}ms`)
|
||||||
new Error(
|
);
|
||||||
`${operationName} timed out after ${timeoutMs}ms`
|
}, timeoutMs)
|
||||||
)
|
|
||||||
); },
|
|
||||||
timeoutMs
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue