Skip to content

Commit

Permalink
Ignore exceptions when publishing messages to some subscriber. (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc authored Nov 18, 2024
1 parent 7360073 commit ec54e3e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions libs/server/Resp/PubSubCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public override unsafe void Publish(ref byte* keyPtr, int keyLength, ref byte* v
if (dcurr > networkSender.GetResponseObjectHead())
Send(networkSender.GetResponseObjectHead());
}
catch
{
// Ignore exceptions
}
finally
{
networkSender.ExitAndReturnResponseObject();
Expand All @@ -68,16 +72,19 @@ public override unsafe void PrefixPublish(byte* patternPtr, int patternLength, r
}
while (!RespWriteUtils.WriteBulkString("pmessage"u8, ref dcurr, dend))
SendAndReset();
while (!RespWriteUtils.WriteBulkString(new Span<byte>(patternPtr + sizeof(int), patternLength - sizeof(int)), ref dcurr, dend))
SendAndReset();
while (!RespWriteUtils.WriteBulkString(new Span<byte>(keyPtr + sizeof(int), keyLength - sizeof(int)), ref dcurr, dend))
SendAndReset();
while (!RespWriteUtils.WriteBulkString(new Span<byte>(valPtr + sizeof(int), valLength - sizeof(int)), ref dcurr, dend))
SendAndReset();

// Write pattern, key, and value to the network
WriteDirectLargeRespString(new Span<byte>(patternPtr + sizeof(int), patternLength - sizeof(int)));
WriteDirectLargeRespString(new Span<byte>(keyPtr + sizeof(int), keyLength - sizeof(int)));
WriteDirectLargeRespString(new Span<byte>(valPtr + sizeof(int), valLength - sizeof(int)));

if (dcurr > networkSender.GetResponseObjectHead())
Send(networkSender.GetResponseObjectHead());
}
catch
{
// Ignore exceptions
}
finally
{
networkSender.ExitAndReturnResponseObject();
Expand Down

0 comments on commit ec54e3e

Please sign in to comment.