Skip to content

Commit

Permalink
Revert "Revert "Fix schdule lock""
Browse files Browse the repository at this point in the history
This reverts commit 8febd78.
  • Loading branch information
site0801 committed Oct 11, 2023
1 parent 8dd3cc4 commit 2e05a84
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 @@ -78,7 +79,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 2e05a84

Please sign in to comment.