Skip to content

Commit

Permalink
Fix schdule lock
Browse files Browse the repository at this point in the history
  • Loading branch information
chez-shanpu committed May 29, 2023
1 parent 4ce6671 commit 210318b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/pkg/api/server_add_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func (s *ShoesLXDMultiServer) AddInstance(ctx context.Context, req *pb.AddInstan

var client lxd.InstanceServer
if errors.Is(err, ErrInstanceIsNotFound) {
s.mu.Lock()
host, err := s.scheduleHost(targetLXDHosts)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "failed to schedule host: %+v", err)
Expand All @@ -77,7 +78,6 @@ func (s *ShoesLXDMultiServer) AddInstance(ctx context.Context, req *pb.AddInstan
return nil, fmt.Errorf("failde to parse limits.memory: %w", err)
}

s.mu.Lock()
cache, err := lxdclient.GetStatusCache(host.HostConfig.LxdHost)
if err != nil {
return nil, err
Expand Down

0 comments on commit 210318b

Please sign in to comment.