I found that sometimes tasks would end up in a rejected state when
trying to update them quickly. The problem was that Shutdown could fail
if called before the container was started. Instead of returning an
error in this case, Shutdown should succeed. This allows tasks to
progress to the "shutdown" state as expected.
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
(cherry picked from commit 37b492ae1b2ba5f84cd0b795dbc68804d7b2fec5)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
| ... | ... |
@@ -323,8 +323,10 @@ func (r *controller) Shutdown(ctx context.Context) error {
|
| 323 | 323 |
|
| 324 | 324 |
// remove container from service binding |
| 325 | 325 |
if err := r.adapter.deactivateServiceBinding(); err != nil {
|
| 326 |
- log.G(ctx).WithError(err).Errorf("failed to deactivate service binding for container %s", r.adapter.container.name())
|
|
| 327 |
- return err |
|
| 326 |
+ log.G(ctx).WithError(err).Warningf("failed to deactivate service binding for container %s", r.adapter.container.name())
|
|
| 327 |
+ // Don't return an error here, because failure to deactivate |
|
| 328 |
+ // the service binding is expected if the container was never |
|
| 329 |
+ // started. |
|
| 328 | 330 |
} |
| 329 | 331 |
|
| 330 | 332 |
if err := r.adapter.shutdown(ctx); err != nil {
|