Skip to content

Commit

Permalink
Update error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
pschork committed Jan 22, 2025
1 parent 4ccea2c commit 29392cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions disperser/dataapi/operator_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ func (oh *OperatorHandler) ProbeOperatorHosts(ctx context.Context, operatorId st
operatorSocket := core.OperatorSocket(operatorInfo.Socket)
retrievalSocket := operatorSocket.GetRetrievalSocket()
retrievalPortOpen := checkIsOperatorPortOpen(retrievalSocket, 3, oh.logger)
retrievalOnline, retrievalStatus := false, "port closed"
retrievalOnline, retrievalStatus := false, fmt.Sprintf("port closed or unreachable for %s", retrievalSocket)
if retrievalPortOpen {
retrievalOnline, retrievalStatus = checkServiceOnline(ctx, "node.Retrieval", retrievalSocket, 3*time.Second)
}

dispersalSocket := operatorSocket.GetV1DispersalSocket()
dispersalPortOpen := checkIsOperatorPortOpen(dispersalSocket, 3, oh.logger)
dispersalOnline, dispersalStatus := false, "port closed"
dispersalOnline, dispersalStatus := false, fmt.Sprintf("port closed or unreachable for %s", dispersalSocket)
if dispersalPortOpen {
dispersalOnline, dispersalStatus = checkServiceOnline(ctx, "node.Dispersal", dispersalSocket, 3*time.Second)
}
Expand Down Expand Up @@ -115,11 +115,11 @@ func checkServiceOnline(ctx context.Context, serviceName string, socket string,
if list := r.GetListServicesResponse(); list != nil {
for _, service := range list.GetService() {
if service.GetName() == serviceName {
return true, "available"
return true, fmt.Sprintf("%s is available", serviceName)
}
}
}
return false, "unavailable"
return false, fmt.Sprintf("grpc available but %s service not found at %s", serviceName, socket)
}

func (oh *OperatorHandler) GetOperatorsStake(ctx context.Context, operatorId string) (*OperatorsStakeResponse, error) {
Expand Down

0 comments on commit 29392cf

Please sign in to comment.