|
@@ 85-100 (lines=16) @@
|
| 82 |
|
* |
| 83 |
|
* @param InstanceStateEvent $event |
| 84 |
|
*/ |
| 85 |
|
public function onInstanceReachable(InstanceStateEvent $event) |
| 86 |
|
{ |
| 87 |
|
$instance = $event->getInstance(); |
| 88 |
|
$instanceState = $this->getInstanceState($instance); |
| 89 |
|
|
| 90 |
|
// Update reachability state now that we know the instance is reachable |
| 91 |
|
if ($instanceState->getReachability() === InstanceState::MAYBE_REACHABLE) |
| 92 |
|
{ |
| 93 |
|
$this->logger |
| 94 |
|
->info('Instance {instanceName} is now reachable, will start polling for updates', [ |
| 95 |
|
'instanceName' => $instance->getName(), |
| 96 |
|
]); |
| 97 |
|
|
| 98 |
|
$instanceState->setReachability(InstanceState::REACHABLE); |
| 99 |
|
} |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
|
| 103 |
|
/** |
|
@@ 108-122 (lines=15) @@
|
| 105 |
|
* |
| 106 |
|
* @param InstanceStateEvent $event |
| 107 |
|
*/ |
| 108 |
|
public function onInstanceUnreachable(InstanceStateEvent $event) |
| 109 |
|
{ |
| 110 |
|
$instance = $event->getInstance(); |
| 111 |
|
$instanceState = $this->getInstanceState($instance); |
| 112 |
|
|
| 113 |
|
// Mark the instance as unreachable |
| 114 |
|
$message = 'Instance {instanceName} not reachable, will wait for {cycles} cycles before retrying'; |
| 115 |
|
|
| 116 |
|
$this->logger->alert($message, [ |
| 117 |
|
'instanceName' => $instance->getName(), |
| 118 |
|
'cycles' => self::UNREACHABLE_CYCLES_UNTIL_RETRY, |
| 119 |
|
]); |
| 120 |
|
|
| 121 |
|
$instanceState->setReachability(InstanceState::UNREACHABLE); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
|
| 125 |
|
/** |