Hi Srdjan,
I definitely understand the nuances you're describing. Could Service Weaver defer on the hard parts by returning a slice of currently known components that the application developer could then iterate and handle each error as they see fit?
Something like:
```
// Retrieves defined component instances that exist at that moment. A more
// flexible future solution could use a channel to be notified of status changes
// (instances spinning up, down, or status becomes unknown) so that
// applications that need precise control could have it.
myComps, err := weaver.CurrentInstances[MyComponent](root)
if err != nil {
t.Fatal(err)
}
// Application could perform this behavior async with a wait group or channel
// sized for len(myComps), simple example shown just for discussion.
for _, myComp := range myComps {
err = myComp.MyFunc(ctx, "invalidate-cache")
if errors.Is(err, weaver.ErrRetriable) {
// retry, omitted for example
continue
}
// Could have an error type for when component is still instantiating
if errors.Is(err, weaver.ErrInitializing) {
// apps would likely just skip the instance, but could do something
// like place it in a queue to retry
continue
}
// Could have an error type for when component is spinning down
if errors.Is(err, weaver.ErrStopping) {
// again, apps would most likely skip the instance, but could
// choose to do something
continue
}
}
```