Fix validator's activity api handler.

This commit is contained in:
cheatfate 2022-09-27 14:04:07 +03:00
parent 4ecda9a317
commit c62a450802
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
1 changed files with 17 additions and 12 deletions

View File

@ -1937,18 +1937,23 @@ proc getValidatorsActivity*(
let resp = vc.onceToAll(RestPlainResponse, SlotDuration, let resp = vc.onceToAll(RestPlainResponse, SlotDuration,
{BeaconNodeRole.Duties}, {BeaconNodeRole.Duties},
getValidatorsActivity(it, epoch, validators)) getValidatorsActivity(it, epoch, validators))
case resp.status if len(resp.data) == 0:
of ApiOperation.Timeout: case resp.status
debug "Unable to perform validator's activity request in time", of ApiOperation.Success:
timeout = SlotDuration # This should not be happened, there should be present at least one
return GetValidatorsActivityResponse() # successfull response.
of ApiOperation.Interrupt: return GetValidatorsActivityResponse()
debug "Validator's activity request was interrupted" of ApiOperation.Timeout:
return GetValidatorsActivityResponse() debug "Unable to perform validator's activity request in time",
of ApiOperation.Failure: timeout = SlotDuration
debug "Unexpected error happened while receiving validator's activity" return GetValidatorsActivityResponse()
return GetValidatorsActivityResponse() of ApiOperation.Interrupt:
of ApiOperation.Success: debug "Validator's activity request was interrupted"
return GetValidatorsActivityResponse()
of ApiOperation.Failure:
debug "Unexpected error happened while receiving validator's activity"
return GetValidatorsActivityResponse()
else:
var activities: seq[RestActivityItem] var activities: seq[RestActivityItem]
for apiResponse in resp.data: for apiResponse in resp.data:
if apiResponse.data.isErr(): if apiResponse.data.isErr():