cloudapi: prevent dangling manifest goroutines

When composer exits, it doesn't wait for the manifest generation goroutines
to finish. This is generally a bad practice so let's introduce a bit of
syncing and a new Shutdown method to prevent this.

This also prevents the manifest generation goroutine from creating weird
states when interrupted on a random line of code.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2022-04-05 14:25:47 +02:00 committed by Tomáš Hozza
parent 02091ba777
commit ba236180fc
4 changed files with 34 additions and 3 deletions

View file

@ -23,3 +23,7 @@ func NewServer(workers *worker.Server, distros *distroregistry.Registry, config
func (server *Server) V2(path string) http.Handler {
return server.v2.Handler(path)
}
func (server *Server) Shutdown() {
server.v2.Shutdown()
}