Hello,
This is not technically an error, but the MultiService implementation currently returns as soon as the first service has run and the parallel goroutines for the other ones have started. The problem is that if this happens e.g. in a web server handling an MDM request, the request might return before all services have executed, and subsequent requests might not yet see the results of those services. That can be a surprising (and hard to identify/debug) behaviour.
In our nanomdm fork at Fleet, we merged a PR to ensure the MultiService does not return until all services have been executed. It maintains the same behaviour and optimization, in that it returns the results of the first service registered and runs all others in parallel, but it waits for the completion instead of leaving the goroutines running unattended. You can see it here: https://github.com/fleetdm/nanomdm/pull/4/files
If that's something you'd be interested in having upstream, I'd be happy to contribute the PR.
Thanks,
Martin
Hello,
This is not technically an error, but the
MultiServiceimplementation currently returns as soon as the first service has run and the parallel goroutines for the other ones have started. The problem is that if this happens e.g. in a web server handling an MDM request, the request might return before all services have executed, and subsequent requests might not yet see the results of those services. That can be a surprising (and hard to identify/debug) behaviour.In our nanomdm fork at Fleet, we merged a PR to ensure the
MultiServicedoes not return until all services have been executed. It maintains the same behaviour and optimization, in that it returns the results of the first service registered and runs all others in parallel, but it waits for the completion instead of leaving the goroutines running unattended. You can see it here: https://github.com/fleetdm/nanomdm/pull/4/filesIf that's something you'd be interested in having upstream, I'd be happy to contribute the PR.
Thanks,
Martin