Replies: 1 comment 2 replies
-
Hey. It sounds like a general async rust question rather than nats. If you want to get errors from Not sure why you would need to restart all subsriptions on If you decide to panic in your app - you probably have a reason to do it (unrecoverable error that should crash the app). Not sure why you would like to recover other way than by restaring the app. If you do not want to crash, error instread of panic. You can also communicate across tasks via channels, like I would love to help, but I'm not sure how. |
Beta Was this translation helpful? Give feedback.
-
What's a good way to do error/panic handling and cleanup when spawning many tasks that subscribe to various subjects or stream consumers?
tokio::spawn
ignores panics if theJoinHandle
is dropped.JoinSet
+ restarting all subscription on error/panic works I think, but feels too heavy-handed. Writing a custom spawning function feels wrong, I can't believe there isn't a better way to do it.This isn't really a NATS-only question per se, but having a solution to this problem is particularly important for code that relies on NATS.
Beta Was this translation helpful? Give feedback.
All reactions