debug conn by chat connection id from contact info

This commit is contained in:
Alexander Bondarenko
2024-04-30 20:10:25 +03:00
parent ef5a144b7b
commit d0f21b943c
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -2157,7 +2157,10 @@ processChatCommand' vr = \case
ads <- mapM readTVarIO =<< readTVarIO =<< asks agentDeliveryStatuses
let collect (acId, ds) = if not showAll && agentDeliveryOk ds then Nothing else Just (decodeLatin1 $ strEncode acId, ds)
pure $ CRDebugDelivery . M.fromList . mapMaybe collect $ M.toList ads
DebugConnection acId@(AgentConnId acId') -> do
DebugConnection (Left connId) -> withUser $ \user -> do
Connection {agentConnId} <- withStore $ \db -> getConnectionById db vr user connId
processChatCommand $ DebugConnection (Right agentConnId)
DebugConnection (Right acId@(AgentConnId acId')) -> do
user@User {userId} <- withStore' (`getUserByAConnId` acId) >>= maybe (throwError . ChatErrorStore $ SEUserNotFoundByAConnId acId) pure
AS.RcvQueue {server, rcvId = rcvId', status = rqStatus} <- withAgent $ \ac ->
-- dive into agent internals
@@ -7385,7 +7388,7 @@ chatCommandP =
("/quit" <|> "/q" <|> "/exit") $> QuitChat,
("/version" <|> "/v") $> ShowVersion,
"/debug delivery" *> (DebugDelivery <$> (" all" $> True <|> pure False)),
"/debug conn " *> (DebugConnection . AgentConnId <$> base64P), -- TODO get by decimal connId too
"/debug conn " *> (DebugConnection <$> ((Left <$> A.decimal) <|> (Right . AgentConnId <$> base64P))),
"/debug locks" $> DebugLocks,
"/debug event " *> (DebugEvent <$> jsonP),
"/get stats" $> GetAgentStats,
+1 -1
View File
@@ -507,7 +507,7 @@ data ChatCommand
| QuitChat
| ShowVersion
| DebugDelivery Bool
| DebugConnection AgentConnId
| DebugConnection (Either Int64 AgentConnId)
| DebugLocks
| DebugEvent ChatResponse
| GetAgentStats