1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-24 15:14:30 +02:00

added DefaultClient.Send panic/recover handling as an extra precaution

This commit is contained in:
Gani Georgiev
2025-09-22 22:52:58 +03:00
parent 54fb4293c5
commit 6ad42bde29

View File

@@ -272,12 +272,14 @@ func (c *DefaultClient) IsDiscarded() bool {
// Send sends the specified message to the client's channel (if not discarded). // Send sends the specified message to the client's channel (if not discarded).
func (c *DefaultClient) Send(m Message) { func (c *DefaultClient) Send(m Message) {
c.mu.RLock() if c.IsDiscarded() {
defer c.mu.RUnlock()
if c.isDiscarded {
return return
} }
// gracefully handle panics since channel close is not blocking and could cause races
defer func() {
recover()
}()
c.channel <- m c.channel <- m
} }