| 1425 | |
| 1426 | |
| 1427 | void BackupsWorker::cancelAll(bool wait_) |
| 1428 | { |
| 1429 | std::vector<OperationID> current_operations; |
| 1430 | { |
| 1431 | std::lock_guard lock{infos_mutex}; |
| 1432 | for (const auto & [id, extended_info] : infos) |
| 1433 | if (!isFinalStatus(extended_info.info.status)) |
| 1434 | current_operations.push_back(id); |
| 1435 | } |
| 1436 | |
| 1437 | if (current_operations.empty()) |
| 1438 | return; |
| 1439 | |
| 1440 | LOG_INFO(log, "Cancelling running backups and restores"); |
| 1441 | |
| 1442 | for (const auto & id : current_operations) |
| 1443 | cancel(id, /* wait= */ false); |
| 1444 | |
| 1445 | if (wait_) |
| 1446 | for (const auto & id : current_operations) |
| 1447 | wait(id, /* rethrow_exception= */ false); |
| 1448 | |
| 1449 | LOG_INFO(log, "Backups and restores finished or stopped"); |
| 1450 | } |
| 1451 | |
| 1452 | |
| 1453 | BackupOperationInfo BackupsWorker::getInfo(const OperationID & id) const |
no test coverage detected