Skip to content

Commit

Permalink
move TryLock up
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaiszaher committed Oct 17, 2023
1 parent 793aafb commit ab78b2b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions server/events/project_command_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,15 @@ func (p *DefaultProjectCommandBuilder) buildProjectPlanCommand(ctx *command.Cont

var pcc []command.ProjectContext

ctx.Log.Debug("building plan command")
unlockFn, err := p.WorkingDirLocker.TryLock(ctx.Pull.BaseRepo.FullName, ctx.Pull.Num, workspace, DefaultRepoRelDir)
if err != nil {
return pcc, err
}
defer unlockFn()

ctx.Log.Debug("cloning repository")
_, _, err := p.WorkingDir.Clone(ctx.HeadRepo, ctx.Pull, workspace)
_, _, err = p.WorkingDir.Clone(ctx.HeadRepo, ctx.Pull, workspace)
if err != nil {
return pcc, err
}
Expand Down Expand Up @@ -586,13 +593,6 @@ func (p *DefaultProjectCommandBuilder) buildProjectPlanCommand(ctx *command.Cont
}
}

ctx.Log.Debug("building plan command")
unlockFn, err := p.WorkingDirLocker.TryLock(ctx.Pull.BaseRepo.FullName, ctx.Pull.Num, workspace, DefaultRepoRelDir)
if err != nil {
return pcc, err
}
defer unlockFn()

repoRelDir := DefaultRepoRelDir
if cmd.RepoRelDir != "" {
repoRelDir = cmd.RepoRelDir
Expand Down

0 comments on commit ab78b2b

Please sign in to comment.