| 182 | |
| 183 | template <class Fn> |
| 184 | auto with_retry(Fn fn) { |
| 185 | auto total_delay = 0ms; |
| 186 | for (;;) { |
| 187 | if (auto res = fn()) |
| 188 | return res; |
| 189 | total_delay += 50ms; |
| 190 | if (total_delay > 2s) { |
| 191 | std::cout << "failed to connect" << std::endl; |
| 192 | abort(); |
| 193 | } |
| 194 | std::this_thread::sleep_for(50ms); |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | std::optional<int32_t> read_cell_value(scoped_actor& self, const actor& cell) { |
| 199 | std::optional<int32_t> result; |