| 680 | } |
| 681 | |
| 682 | void reaped(const Future<Option<int>>& run) |
| 683 | { |
| 684 | if (terminated) { |
| 685 | return; |
| 686 | } |
| 687 | |
| 688 | terminated = true; |
| 689 | |
| 690 | // Stop health checking the task. |
| 691 | if (checker.get() != nullptr) { |
| 692 | checker->pause(); |
| 693 | } |
| 694 | |
| 695 | // In case the stop is stuck, discard it. |
| 696 | stop.discard(); |
| 697 | |
| 698 | // We wait for inspect to finish in order to ensure we send |
| 699 | // the TASK_RUNNING status update. |
| 700 | inspect |
| 701 | .onAny(defer(self(), &Self::_reaped, run)); |
| 702 | |
| 703 | // If the inspect takes too long we discard it to ensure we |
| 704 | // don't wait forever, however in this case there may be no |
| 705 | // TASK_RUNNING update. |
| 706 | inspect |
| 707 | .after(DOCKER_INSPECT_TIMEOUT, [=](const Future<Nothing>&) { |
| 708 | inspect.discard(); |
| 709 | return inspect; |
| 710 | }); |
| 711 | } |
| 712 | |
| 713 | void _reaped(const Future<Option<int>>& run) |
| 714 | { |