Skip to content

Commit

Permalink
fix some deadlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
sharnoff committed Sep 27, 2023
1 parent 122e02a commit 428fa13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 2 additions & 0 deletions pkg/agent/core/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,8 @@ func (h NeonVMHandle) RequestSuccessful(now time.Time) {
// necessary changes.
h.s.vm.Cpu.Use = resources.VCPU
h.s.vm.Mem.Use = resources.Mem

h.s.neonvm.ongoingRequested = nil
}

func (h NeonVMHandle) RequestFailed(now time.Time) {
Expand Down
8 changes: 1 addition & 7 deletions pkg/agent/informant.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,11 +970,8 @@ func (s *InformantServer) HealthCheck(ctx context.Context, logger *zap.Logger) (

// Downscale makes a request to the informant's /downscale endpoint with the api.Resources
//
// This method MUST NOT be called while holding i.server.runner.lock OR i.server.requestLock.
// This method MUST NOT be called while holding i.server.runner.lock.
func (s *InformantServer) Downscale(ctx context.Context, logger *zap.Logger, to api.Resources) (*api.DownscaleResult, error) {
s.requestLock.Lock()
defer s.requestLock.Unlock()

err := func() error {
s.runner.lock.Lock()
defer s.runner.lock.Unlock()
Expand Down Expand Up @@ -1027,9 +1024,6 @@ func (s *InformantServer) Downscale(ctx context.Context, logger *zap.Logger, to
}

func (s *InformantServer) Upscale(ctx context.Context, logger *zap.Logger, to api.Resources) error {
s.requestLock.Lock()
defer s.requestLock.Unlock()

err := func() error {
s.runner.lock.Lock()
defer s.runner.lock.Unlock()
Expand Down

0 comments on commit 428fa13

Please sign in to comment.