Commit b33eba1b authored by jan.koester's avatar jan.koester
Browse files

test

parent 3a0303b8
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
mediadb (20260419+33) unstable; urgency=medium

  * Fix startup hang: start_sync now has a 30-second total time budget.
    If the initial cluster sync does not complete in time (e.g. due to
    slow network or stripe retrieval retries in libparitypp), the server
    starts anyway and the background sync_loop continues retrying.

 -- Jan Koester <jan.koester@tuxist.de>  Sat, 19 Apr 2026 00:00:00 +0200

mediadb (20260419+32) unstable; urgency=medium

  * Cluster-wide store deletion via tombstones: deleting a store on one
+10 −2
Original line number Diff line number Diff line
@@ -2432,8 +2432,11 @@ ClusterMediaBackend::ClusterMediaBackend(Cluster& cluster, BlobCache& cache)
    : local_(), cluster_(cluster), cache_(cache) {}

void ClusterMediaBackend::start_sync() {
    // Retry initial sync up to 5 times — peers may need a few seconds
    // to become fully available even after waitForPeers returns.
    // Retry initial sync with a total time budget of 30 seconds.
    // If the cluster layer is slow (connection timeouts, stripe retries),
    // don't block server startup indefinitely — the background sync_loop
    // will keep retrying.
    auto deadline = std::chrono::steady_clock::now() + std::chrono::seconds(30);
    for (int attempt = 1; attempt <= 5; ++attempt) {
        sync_from_cluster();
        if (initial_sync_ok_.load()) {
@@ -2446,6 +2449,11 @@ void ClusterMediaBackend::start_sync() {
                      << ": " << sids.size() << " stores, " << total_albums << " albums\n";
            break;
        }
        if (std::chrono::steady_clock::now() >= deadline) {
            std::cerr << "[CLUSTER-SYNC] initial sync time budget exhausted after "
                      << attempt << " attempts, continuing in background\n";
            break;
        }
        std::cerr << "[CLUSTER-SYNC] initial sync attempt " << attempt
                  << "/5 incomplete, retrying in 2s\n";
        std::this_thread::sleep_for(std::chrono::seconds(2));