From 2157e8980dcf7046596ab776d226d4a9d554ff7e Mon Sep 17 00:00:00 2001 From: jangko Date: Wed, 31 Jan 2024 16:46:44 +0700 Subject: [PATCH] Should compile if chronicles log turned on --- json_rpc/clients/httpclient.nim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/json_rpc/clients/httpclient.nim b/json_rpc/clients/httpclient.nim index 5a8c555..15c6caa 100644 --- a/json_rpc/clients/httpclient.nim +++ b/json_rpc/clients/httpclient.nim @@ -89,10 +89,6 @@ proc callImpl(client: RpcHttpClient, reqBody: string): Future[string] {.async.} var req: HttpClientRequestRef var res: HttpClientResponseRef - debug "Sending message to RPC server", - address = client.httpAddress, msg_len = len(reqBody), name - trace "Message", msg = reqBody - req = HttpClientRequestRef.post(client.httpSession, client.httpAddress.get, body = reqBody.toOpenArrayByte(0, reqBody.len - 1), @@ -144,10 +140,16 @@ proc newRpcHttpClient*( method call*(client: RpcHttpClient, name: string, params: RequestParamsTx): Future[JsonString] {.async, gcsafe.} = + let id = client.getNextId() reqBody = requestTxEncode(name, params, id) - resText = await client.callImpl(reqBody) + + debug "Sending message to RPC server", + address = client.httpAddress, msg_len = len(reqBody), name + trace "Message", msg = reqBody + + let resText = await client.callImpl(reqBody) # completed by processMessage - the flow is quite weird here to accomodate # socket and ws clients, but could use a more thorough refactoring