From 63614bb15291e276f166b0250b4c0cb2835dec84 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 31 Aug 2023 09:18:48 -0300 Subject: [PATCH] add goroutine leak warning. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 046056f..ef81df4 100644 --- a/README.md +++ b/README.md @@ -140,3 +140,9 @@ func main() { ``` go run example/example.go ``` + +## Warning: risk of goroutine bloat + +Remember to cancel subscriptions, either by calling `.Unsub()` on them or ensuring their `context.Context` will be canceled at some point. +If you don't do that they will keep creating a new goroutine for every new event that arrives and if you have stopped listening on the +`sub.Events` channel that will cause chaos and doom in your program.