mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-08 05:47:07 +09:00
GO-4243 close spaces in parallel
This commit is contained in:
parent
b2d64daa49
commit
c9897e867e
1 changed files with 10 additions and 4 deletions
|
@ -442,12 +442,18 @@ func (s *service) Close(ctx context.Context) error {
|
|||
}
|
||||
s.mu.Unlock()
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
for _, ctrl := range ctrls {
|
||||
err := ctrl.Close(ctx)
|
||||
if err != nil {
|
||||
log.Error("close space", zap.String("spaceId", ctrl.SpaceId()), zap.Error(err))
|
||||
}
|
||||
wg.Add(1)
|
||||
go func(ctrl spacecontroller.SpaceController) {
|
||||
defer wg.Done()
|
||||
err := ctrl.Close(ctx)
|
||||
if err != nil {
|
||||
log.Error("close space", zap.String("spaceId", ctrl.SpaceId()), zap.Error(err))
|
||||
}
|
||||
}(ctrl)
|
||||
}
|
||||
wg.Wait()
|
||||
err := s.techSpace.Close(ctx)
|
||||
if err != nil {
|
||||
log.Error("close tech space", zap.Error(err))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue