mirror of https://github.com/docker/cli.git
Minor refactor: use anyChanged() to detect changed flags
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
df43eb931e
commit
df9a0c7797
|
@ -313,12 +313,13 @@ func updateService(ctx context.Context, apiClient client.NetworkAPIClient, flags
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags.Changed(flagLimitCPU) || flags.Changed(flagLimitMemory) {
|
if anyChanged(flags, flagLimitCPU, flagLimitMemory) {
|
||||||
taskResources().Limits = spec.TaskTemplate.Resources.Limits
|
taskResources().Limits = spec.TaskTemplate.Resources.Limits
|
||||||
updateInt64Value(flagLimitCPU, &task.Resources.Limits.NanoCPUs)
|
updateInt64Value(flagLimitCPU, &task.Resources.Limits.NanoCPUs)
|
||||||
updateInt64Value(flagLimitMemory, &task.Resources.Limits.MemoryBytes)
|
updateInt64Value(flagLimitMemory, &task.Resources.Limits.MemoryBytes)
|
||||||
}
|
}
|
||||||
if flags.Changed(flagReserveCPU) || flags.Changed(flagReserveMemory) {
|
|
||||||
|
if anyChanged(flags, flagReserveCPU, flagReserveMemory) {
|
||||||
taskResources().Reservations = spec.TaskTemplate.Resources.Reservations
|
taskResources().Reservations = spec.TaskTemplate.Resources.Reservations
|
||||||
updateInt64Value(flagReserveCPU, &task.Resources.Reservations.NanoCPUs)
|
updateInt64Value(flagReserveCPU, &task.Resources.Reservations.NanoCPUs)
|
||||||
updateInt64Value(flagReserveMemory, &task.Resources.Reservations.MemoryBytes)
|
updateInt64Value(flagReserveMemory, &task.Resources.Reservations.MemoryBytes)
|
||||||
|
|
Loading…
Reference in New Issue