This commit is contained in:
spaced4ndy
2026-08-13 21:07:22 +04:00
parent 261e6103f8
commit 9170a3041f
7 changed files with 65 additions and 35 deletions
+4 -3
View File
@@ -1477,9 +1477,10 @@ processChatCommand cxt nm = \case
pure $ CRServiceReplyAccepted user (AgentConnId connId)
APIRejectServiceRequest userId requestId reason -> withUserId userId $ \user -> do
let AgentInvId invId = requestId
-- a reason is required for the requester to fail fast; without it the request is
-- dropped silently and the caller waits out its timeout
withAgent $ \a -> rejectServiceRequest a NRMInteractive (aUserId user) invId (encodeUtf8 <$> reason)
-- A reason is required for the requester to fail fast; without it the request is dropped
-- silently and the caller waits out its timeout. Async, so a service shedding load does
-- not block on a network round trip per rejected request.
withAgent $ \a -> rejectServiceRequestAsync a "" (aUserId user) invId (encodeUtf8 <$> reason)
ok user
APISendCallInvitation contactId callType -> withUser $ \user -> do
-- party initiating call
+4 -2
View File
@@ -1368,8 +1368,10 @@ processAgentMessageConn cxt user@User {userId} corrId agentConnId agentMessage =
chatReadVar processServiceRequests >>= \case
True -> case J.eitherDecodeStrict' =<< decompressServiceBody payload of
Right request -> toView $ CEvtServiceRequest user (AgentInvId invId) sigKey_ request
Left _ -> dropSReq
False -> dropSReq
Left e -> logError ("service request dropped, invalid payload: " <> tshow e) >> dropSReq
-- the requester gets no reply and waits out its timeout, so this must be visible
-- to whoever deployed the service without enabling service requests
False -> logError "service request dropped: service requests are not enabled" >> dropSReq
where
dropSReq = withAgent $ \a -> rejectServiceRequest a NRMBackground (aUserId user) invId Nothing
LINK _link auData ->