mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-06 17:57:42 +02:00
Add client configurable timeouts
This commit is contained in:
@@ -98,9 +98,11 @@ export class NetworkClientImpl implements NetworkClient {
|
||||
constructor (
|
||||
readonly host: string,
|
||||
port: number,
|
||||
private readonly tickMgr: TickManager
|
||||
private readonly tickMgr: TickManager,
|
||||
aliveTimeout?: number
|
||||
) {
|
||||
this.client = new BackRPCClient<ClientUuid>(this.clientId, this, host, port, tickMgr)
|
||||
const options = undefined
|
||||
this.client = new BackRPCClient<ClientUuid>(this.clientId, this, host, port, tickMgr, options, aliveTimeout)
|
||||
}
|
||||
|
||||
async waitConnection (timeout?: number): Promise<void> {
|
||||
|
||||
@@ -26,11 +26,11 @@ process.on('exit', () => {
|
||||
shutdownNetworkTickMgr()
|
||||
})
|
||||
|
||||
export function createNetworkClient (url: string): NetworkClient {
|
||||
export function createNetworkClient (url: string, aliveTimeout?: number): NetworkClient {
|
||||
const [host, portStr] = url.split(':')
|
||||
const port = portStr != null ? parseInt(portStr, 10) : 3737
|
||||
tickMgr.start()
|
||||
return new NetworkClientImpl(host, port, tickMgr)
|
||||
return new NetworkClientImpl(host, port, tickMgr, aliveTimeout)
|
||||
}
|
||||
|
||||
export async function createAgent (
|
||||
|
||||
Reference in New Issue
Block a user