Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion services/api/resolutions.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import (
)

func (api *ArcadiaAPI) RespondError(w http.ResponseWriter, code int, message string) {
api.Respond(w, code, HTTPErrorResp{code, message})
if code == http.StatusNoContent {
// status 204 cannot be sent with payload
api.Respond(w, code, nil)
} else {
api.Respond(w, code, HTTPErrorResp{code, message})
}
}

func (api *ArcadiaAPI) RespondOK(w http.ResponseWriter, response any) {
Expand Down
14 changes: 8 additions & 6 deletions services/api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ func (api *ArcadiaAPI) handleGetPayload(w http.ResponseWriter, req *http.Request
log.WithFields(logrus.Fields{
"timestampRequestFin": time.Now().UTC().UnixMilli(),
"requestDurationUSecs": requestDurationUSecs,
}).Info("request finished")
}).Info("request getPayload finished")

if requestWasSuccess {
getPayloadLatency.Observe(float64(requestDurationUSecs))
Expand Down Expand Up @@ -1233,7 +1233,7 @@ func (api *ArcadiaAPI) handleAuctionBid(w http.ResponseWriter, req *http.Request
"method": "auctionBid",
"timestampRequestFin": time.Now().UTC().UnixMilli(),
"requestDurationUSecs": requestDurationUSecs,
}).Info("request finished")
}).Info("request auctionBid finished")

if requestWasSuccess {
auctionBidLatency.Observe(float64(requestDurationUSecs))
Expand Down Expand Up @@ -1551,7 +1551,7 @@ func (api *ArcadiaAPI) handleSubmitNewBlockRequest(w http.ResponseWriter, req *h
log.WithFields(logrus.Fields{
"timestampRequestFin": time.Now().UTC().UnixMilli(),
"requestDurationUSecs": requestDurationUSecs,
}).Info("request finished")
}).Info("request submitNewBlock finished")

if requestWasSuccess {
submitNewBlockLatency.Observe(float64(requestDurationUSecs))
Expand Down Expand Up @@ -2373,7 +2373,9 @@ func (api *ArcadiaAPI) handleGetBundleStatus(w http.ResponseWriter, req *http.Re
}

if status == nil || *status == "" {
api.RespondError(w, http.StatusNoContent, fmt.Sprintf("bundle status not found for bundle: %s", bundleStatusReq.BundleHash))
logMsg := fmt.Sprintf("bundle status not found for bundle: %s", bundleStatusReq.BundleHash)
log.WithField("status", status).Warn(logMsg)
api.RespondError(w, http.StatusNoContent, logMsg)
return
}

Expand Down Expand Up @@ -2405,7 +2407,7 @@ func (api *ArcadiaAPI) handleGetArcadiaBlock(w http.ResponseWriter, req *http.Re
"method": "arcadiaBlock",
"timestampRequestFin": time.Now().UTC().UnixMilli(),
"requestDurationUSecs": requestDurationUSecs,
}).Info("request finished")
}).Info("request getArcadiaBlock finished")

if requestWasSuccess {
getArcadiaBlockLatency.Observe(float64(requestDurationUSecs))
Expand Down Expand Up @@ -2727,7 +2729,7 @@ func (api *ArcadiaAPI) handleRecvPreconf(w http.ResponseWriter, req *http.Reques
"method": "recvPreconf",
"timestampRequestFin": time.Now().UTC().UnixMilli(),
"requestDurationUSecs": requestDurationUSecs,
}).Info("request finished")
}).Info("request recvPreconf finished")

if requestWasSuccess {
recvPreconfsLatency.Observe(float64(requestDurationUSecs))
Expand Down