fix: harden single-machine load handling
This commit is contained in:
@@ -4079,6 +4079,12 @@ func serveIMFriendRequestCreate(wrt http.ResponseWriter, req *http.Request) {
|
||||
writeIMRelationError(wrt, req, acceptErr)
|
||||
return
|
||||
}
|
||||
if accepted == nil {
|
||||
logs.Err.Printf("friend request auto-accept returned an empty result: tenant=%d request=%s actor=%s",
|
||||
principal.TenantID, created.RequestID, target.String())
|
||||
writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil)
|
||||
return
|
||||
}
|
||||
created = accepted
|
||||
}
|
||||
if imReliableHTTPEventsEnabled(req) {
|
||||
@@ -6391,6 +6397,12 @@ func serveIMFriendRequestAction(wrt http.ResponseWriter, req *http.Request) {
|
||||
writeIMRelationError(wrt, req, err)
|
||||
return
|
||||
}
|
||||
if updated == nil {
|
||||
logs.Err.Printf("friend request resolution returned an empty result: tenant=%d request=%s actor=%s status=%s",
|
||||
principal.TenantID, requestID, principal.Uid.String(), status)
|
||||
writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil)
|
||||
return
|
||||
}
|
||||
if status == types.FriendRequestAccepted && imReliableHTTPEventsEnabled(req) {
|
||||
topic := updated.ApplicantID.P2PName(updated.TargetID)
|
||||
publishIMConversationSystemNotice(principal.TenantID, topic,
|
||||
|
||||
Reference in New Issue
Block a user