Commit 3d685aef authored by jan.koester's avatar jan.koester
Browse files

test



Co-authored-by: default avatarCopilot <copilot@github.com>
parent a46c0e5c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
mediadb (20260424+81) unstable; urgency=medium

  * Fix preview inflight coalescing: use predicate-based wait_until to prevent
    lost CV notifications causing 30s timeouts on simultaneous requests.

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

mediadb (20260424+80) unstable; urgency=medium

  * Fix video overlay: stop fetch on close (pause + removeAttribute('src'))
+1 −0
Original line number Diff line number Diff line
dh_auto_configure
+1 −0
Original line number Diff line number Diff line
dh_auto_configure
+1 −0
Original line number Diff line number Diff line
dh_auto_configure
+9 −7
Original line number Diff line number Diff line
@@ -731,19 +731,21 @@ std::shared_ptr<const BlobValue> PreviewService::get_or_create_streaming(const M

    {
        std::unique_lock<std::mutex> lk(inflight_mutex_);
        // Wait up to 30 s for a duplicate in-flight render to finish.
        auto deadline = std::chrono::steady_clock::now() + std::chrono::seconds(30);
        while (inflight_.count(key)) {
            lk.unlock();
            if (auto hit = cache_.get(key)) return hit;
            lk.lock();
            if (inflight_cv_.wait_until(lk, deadline) == std::cv_status::timeout) {

        // Wait for a duplicate in-flight render to finish.
        // Uses predicate form so notifications between unlock/relock are not lost.
        if (inflight_.count(key)) {
            std::cerr << "[PREVIEW] coalescing: waiting for in-flight render of " << key << "\n";
            if (!inflight_cv_.wait_until(lk, deadline,
                    [&]{ return inflight_.count(key) == 0; })) {
                error_out = "timeout waiting for in-flight preview";
                return nullptr;
            }
        }

        // Check caches — another thread/node may have finished rendering.
        if (auto hit = cache_.get(key)) return hit;
        // Re-check L2 after inflight wait — another node may have finished rendering
        if (l2_) {
            if (auto hit = l2_->get(key, cache_)) return hit;
        }