Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(engine): do not force register on update binary #6634

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions engine/api/workermodel/registration.go
Original file line number Diff line number Diff line change
@@ -25,17 +25,6 @@ func ComputeRegistrationNeeds(db gorp.SqlExecutor, allBinaryReqs sdk.Requirement

for _, r := range reqs {
switch r.Type {
case sdk.BinaryRequirement:
exist := false
for _, e := range allBinaryReqs {
if e.Value == r.Value {
exist = true
break
}
}
if !exist {
return updateAllToCheckRegistration(db)
}
case sdk.OSArchRequirement:
nbOSArchReq++
case sdk.ModelRequirement:
@@ -63,21 +52,6 @@ func ComputeRegistrationNeeds(db gorp.SqlExecutor, allBinaryReqs sdk.Requirement
return nil
}

// updateAllToCheckRegistration is like need_registration but without exclusive mode
func updateAllToCheckRegistration(db gorp.SqlExecutor) error {
query := `UPDATE worker_model SET check_registration = $1`
res, err := db.Exec(query, true)
if err != nil {
return sdk.WithStack(err)
}
rows, err := res.RowsAffected()
if err != nil {
return sdk.WithStack(err)
}
log.Debug(context.Background(), "updateAllToCheckRegistration> %d worker model(s) check registration", rows)
return nil
}

// UpdateSpawnErrorWorkerModel updates worker model error registration
func UpdateSpawnErrorWorkerModel(db gorp.SqlExecutor, modelID int64, spawnError sdk.SpawnErrorForm) error {
spawnError.Error = sdk.RemoveNotPrintableChar(spawnError.Error)