Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Launcher update speed is measured from the first byte, and a slow source is left after one route

Bowen Xueb7e74aad546d
diff --git a/freevideo_engine/launcher_update.py b/freevideo_engine/launcher_update.py
index 337c5e1..817c396 100644
--- a/freevideo_engine/launcher_update.py
+++ b/freevideo_engine/launcher_update.py
@@ -76,8 +76,9 @@ RELEASE_ASSETS = {CHANNEL: ('FreeVideo.exe', 'update-windows.json'),
CHANNELS = tuple(RELEASE_ASSETS)
MANIFEST_DOMAIN = b'FreeVideo update manifest v1\x00'
# Every platform's mirror manifest carries the release signature, which binds the
-# package digest; the Windows launcher also checks a mirror-only download's
-# Authenticode signature, and a Mac DMG is checked with codesign before use.
+# package digest. The Windows launcher also checks a mirror-only download's
+# Authenticode publisher. The Mac codesign check before use is an integrity check
+# only: it does not require a particular developer identity.
MIRROR_CHANNELS = CHANNELS
RETRY_SECONDS = 60
MAX_RETRY_SECONDS = 15 * 60
diff --git a/freevideo_engine/network.py b/freevideo_engine/network.py
index e50fe9b..b25ea67 100644
--- a/freevideo_engine/network.py
+++ b/freevideo_engine/network.py
@@ -975,13 +975,13 @@ def download_here(candidates, path, expected, progress=None, *, network=None, en
reject(partial, 'hash-rejected')
timeout = network.get('timeout_seconds', 5)
affinity = partial.with_name(partial.name + '.source.json')
- candidates = [(name, address, route, headers, fallback) for name, url in candidates
+ candidates = [(name, address, route, headers, (fallback, rank)) for name, url in candidates
for fallback, (address, headers) in enumerate([(url, ())] +
([(fallbacks[name][0], tuple(fallbacks[name][1]))] if fallbacks and name in fallbacks else []))
- for route in route_order(network, category, name, env)]
+ for rank, route in enumerate(route_order(network, category, name, env))]
if updating:
- # Every source's own address comes before any alternate address, so a
- # slow source is left after one attempt rather than one per address.
+ # Every source's own address on its first route comes before any other
+ # route or alternate address, so a slow source is left after one attempt.
candidates.sort(key=lambda row: row[4])
candidates = [row[:4] for row in candidates]
if not candidates:
@@ -996,10 +996,11 @@ def download_here(candidates, path, expected, progress=None, *, network=None, en
# Try the next ranked candidate promptly. The final candidate gets bounded
# retries; every mirror must honor the retained prefix, with no silent reset.
measured_rates = {}
+ left_slow = set()
for cycle in range(cycles):
# Once every route has been tried, keep the fastest observed route even
# if the user's entire connection is slow. Do not oscillate forever.
- if cycle and updating and not any(measured_rates.values()):
+ if cycle and updating and not left_slow:
break # No source was left for being slow, so none is worth resuming.
if cycle and measured_rates:
candidates.sort(key=lambda row: -measured_rates.get((row[0], row[2]), 0))
@@ -1094,7 +1095,12 @@ def download_here(candidates, path, expected, progress=None, *, network=None, en
# turn these excess bytes into progress or an ETA.
oversized = done
break
- recent.append((now, done))
+ if updating and done == offset:
+ # An update's speed is measured from its first body byte;
+ # a source that sends nothing is left by the stall rule.
+ recent = deque([(now, done)])
+ else:
+ recent.append((now, done))
window = max(5, slow_seconds or 0)
while len(recent) > 2 and recent[1][0] < now - window:
recent.popleft()
@@ -1102,6 +1108,7 @@ def download_here(candidates, path, expected, progress=None, *, network=None, en
and now - recent[0][0] >= slow_seconds
and (done - recent[0][1]) / (now - recent[0][0]) < low_speed_limit):
slow = True
+ left_slow.add((name, route))
break
# Speed samples follow redirects themselves; guarded updates
# must keep every request inside the caller's URL policy.