Skip to content

Commit

Permalink
process gestspaceerr
Browse files Browse the repository at this point in the history
  • Loading branch information
zarkone committed Sep 20, 2024
1 parent 08dd581 commit 8df740d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions nodespace/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,21 @@ var (
ErrSpaceStorageIsLocked = errors.New("SpaceStorage is locked, try again later")
)

// TODO: handle "space is missing" when space id is wrong
func (s *service) GetStats(ctx context.Context, id string) (spaceStats SpaceStats, err error) {
// TODO: this takes 30 seconds
space, err := s.GetSpace(ctx, id)
// when coordinator is not connected, it waits.
space, getSpaceErr := s.GetSpace(ctx, id)
defer func() {
if closeErr := space.Close(); closeErr != nil {
err = errors.Join(err, closeErr)
if getSpaceErr == nil {
if closeErr := space.Close(); closeErr != nil {
err = errors.Join(err, closeErr)
}
}
}()

if err != nil {
if getSpaceErr != nil {
err = getSpaceErr
return
}

Expand Down

0 comments on commit 8df740d

Please sign in to comment.