Skip to content

Commit

Permalink
Don't delete INI jobs
Browse files Browse the repository at this point in the history
If a job is configured in the INI file but not mentioned in the docker labels, do not deregister the job.
  • Loading branch information
jsixface authored and TheDevMinerTV committed Oct 2, 2023
1 parent 95be06b commit b463631
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,9 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) {

// Calculate the delta execJobs
for name, j := range c.ExecJobs {
found := false
for newJobsName, newJob := range parsedLabelConfig.ExecJobs {
// Check if the schedule has changed
if name == newJobsName {
found = true
// There is a slight race condition were a job can be canceled / restarted with different params
// so, lets take care of it by simply restarting
// For the hash to work properly, we must fill the fields before calling it
Expand All @@ -163,11 +161,6 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) {
break
}
}
if !found {
// Remove the job
c.sh.RemoveJob(j)
delete(c.ExecJobs, name)
}
}

// Check for aditions
Expand All @@ -190,11 +183,9 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) {
}

for name, j := range c.RunJobs {
found := false
for newJobsName, newJob := range parsedLabelConfig.RunJobs {
// Check if the schedule has changed
if name == newJobsName {
found = true
// There is a slight race condition were a job can be canceled / restarted with different params
// so, lets take care of it by simply restarting
// For the hash to work properly, we must fill the fields before calling it
Expand All @@ -213,11 +204,6 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) {
break
}
}
if !found {
// Remove the job
c.sh.RemoveJob(j)
delete(c.RunJobs, name)
}
}

// Check for aditions
Expand All @@ -238,7 +224,6 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) {
c.RunJobs[newJobsName] = newJob
}
}

}

// ExecJobConfig contains all configuration params needed to build a ExecJob
Expand Down

0 comments on commit b463631

Please sign in to comment.