| 1143 | |
| 1144 | |
| 1145 | void CheckerProcess::processHttpCheckResult( |
| 1146 | const Stopwatch& stopwatch, |
| 1147 | const Future<int>& future) |
| 1148 | { |
| 1149 | CHECK(!future.isPending()); |
| 1150 | |
| 1151 | Result<CheckStatusInfo> result = None(); |
| 1152 | |
| 1153 | if (future.isReady()) { |
| 1154 | LOG(INFO) << name << " for task '" << taskId << "'" |
| 1155 | << " returned: " << future.get(); |
| 1156 | |
| 1157 | CheckStatusInfo checkStatusInfo; |
| 1158 | checkStatusInfo.set_type(CheckInfo::HTTP); |
| 1159 | checkStatusInfo.mutable_http()->set_status_code( |
| 1160 | static_cast<uint32_t>(future.get())); |
| 1161 | |
| 1162 | result = Result<CheckStatusInfo>(checkStatusInfo); |
| 1163 | } else if (future.isDiscarded()) { |
| 1164 | // Check's status is currently not available due to a transient error, |
| 1165 | // e.g., due to the agent failover, no `CheckStatusInfo` message should |
| 1166 | // be sent to the callback. |
| 1167 | result = None(); |
| 1168 | } else { |
| 1169 | result = Result<CheckStatusInfo>(Error(future.failure())); |
| 1170 | } |
| 1171 | |
| 1172 | processCheckResult(stopwatch, result); |
| 1173 | } |
| 1174 | |
| 1175 | |
| 1176 | #ifdef __WINDOWS__ |