| 229 | } |
| 230 | |
| 231 | void GrStatistics::UpdateRelayAlive(const std::string& device_id, int64_t timestamp) { |
| 232 | auto opt_ra = relays_alive_.TryGet(device_id); |
| 233 | if (opt_ra.has_value()) { |
| 234 | auto ra = opt_ra.value(); |
| 235 | ra->last_update_ts_ = timestamp; |
| 236 | } |
| 237 | else { |
| 238 | auto ra = std::make_shared<GrStatRelayAlive>(); |
| 239 | ra->device_id_ = device_id; |
| 240 | ra->created_ts_ = timestamp; |
| 241 | ra->last_update_ts_ = timestamp; |
| 242 | relays_alive_.Insert(device_id, ra); |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | int64_t GrStatistics::GetRelayLastUpdateTimestamp(const std::string& device_id) { |
| 247 | if (auto r = relays_alive_.TryGet(device_id); r.has_value()) { |
no outgoing calls
no test coverage detected