dart-archive / isolate

Makes working with Dart isolates easier.
https://pub.dev/packages/isolate
BSD 3-Clause "New" or "Revised" License
90 stars 34 forks source link

[Enhancement] Unhandled errors stream for LoadBalancer #23

Closed lexaknyazev closed 5 years ago

lexaknyazev commented 6 years ago

With single IsolateRunner, it's possible to get a Stream of unhandled errors:

final runner = await IsolateRunner.spawn();
runner.errors.listen((_) {}, onError: print);

It would be nice for LoadBalancer to provide a combined Stream of unhandled errors from all spawned runners, or a public API to access each runner.errors from outside.

lrhn commented 5 years ago

The LoadBalancer is not necessarily based on IsolateRunner runners. The Runner API does not have a way to register unhandled asynchronous errors.

Perhaps it would make sense for the default IsolateRunner used in a LoadBalancer to expose uncaught errors to the current zone of the request, but I don't think the LoadBalancer API is the right place to do something that doesn't work for any runner.

lexaknyazev commented 5 years ago

I don't think the LoadBalancer API is the right place to do something that doesn't work for any runner.

Okay, that makes sense.

the default IsolateRunner used in a LoadBalancer

What does it mean? A LoadBalancer is created with a pre-existing collection of Runners (default constructor) of with a generator (static Future<LoadBalancer> create()).

lrhn commented 5 years ago

True, I actually thought there was a default, but there isn't.