mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-15 16:50:16 +01:00
add goroutine leak warning.
This commit is contained in:
@@ -140,3 +140,9 @@ func main() {
|
|||||||
```
|
```
|
||||||
go run example/example.go
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user