Increase REST service timeout setting to 2xSECONDS_PER_SLOT. (#2627)

Fix `ansi_c` warning on Windows.
This commit is contained in:
Eugene Kabanov 2021-06-03 12:43:04 +03:00 committed by GitHub
parent 28a5bca71a
commit 84f3b2dd09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,6 @@ import
# Standard library # Standard library
std/[math, os, osproc, random, sequtils, strformat, strutils, std/[math, os, osproc, random, sequtils, strformat, strutils,
tables, times, terminal], tables, times, terminal],
system/ansi_c,
# Nimble packages # Nimble packages
stew/[objects, byteutils, endians2, io2], stew/shims/macros, stew/[objects, byteutils, endians2, io2], stew/shims/macros,
@ -50,6 +49,9 @@ import
from eth/common/eth_types import BlockHashOrNumber from eth/common/eth_types import BlockHashOrNumber
when defined(posix):
import system/ansi_c
from from
libp2p/protocols/pubsub/gossipsub libp2p/protocols/pubsub/gossipsub
import import
@ -68,7 +70,11 @@ template init(T: type RestServerRef, ip: ValidIpAddress, port: Port): T =
let address = initTAddress(ip, port) let address = initTAddress(ip, port)
let serverFlags = {HttpServerFlags.QueryCommaSeparatedArray, let serverFlags = {HttpServerFlags.QueryCommaSeparatedArray,
HttpServerFlags.NotifyDisconnect} HttpServerFlags.NotifyDisconnect}
let res = RestServerRef.new(getRouter(), address, serverFlags = serverFlags) # We increase default timeout to help validator clients who poll our server
# at least once per slot (12.seconds).
let headersTimeout = seconds(2'i64 * int64(SECONDS_PER_SLOT))
let res = RestServerRef.new(getRouter(), address, serverFlags = serverFlags,
httpHeadersTimeout = headersTimeout)
if res.isErr(): if res.isErr():
notice "Rest server could not be started", address = $address, notice "Rest server could not be started", address = $address,
reason = res.error() reason = res.error()