mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-15 13:03:41 +00:00
fix: reconcile race fix, disk regression for snapshot deletion
This commit is contained in:
parent
09d9e7c23b
commit
218cc3fecb
11 changed files with 193 additions and 123 deletions
|
|
@ -52,6 +52,9 @@ func (d *Daemon) StartMachine(ctx context.Context, id contracthost.MachineID) (*
|
|||
return &contracthost.GetMachineResponse{Machine: machineToContract(*record)}, nil
|
||||
}
|
||||
if record.Phase == contracthost.MachinePhaseStarting {
|
||||
// reconcileMachine acquires the machine lock, so we must release
|
||||
// ours first to avoid self-deadlock.
|
||||
unlock()
|
||||
reconciled, err := d.reconcileMachine(ctx, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -220,6 +223,12 @@ func (d *Daemon) Reconcile(ctx context.Context) error {
|
|||
return err
|
||||
}
|
||||
for _, operation := range operations {
|
||||
unlock, ok := d.tryLockMachine(operation.MachineID)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
unlock()
|
||||
|
||||
switch operation.Type {
|
||||
case model.MachineOperationCreate:
|
||||
if err := d.reconcileCreate(ctx, operation.MachineID); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue