JOHN SILLVESTOR commited on
Commit
ca692a0
·
verified ·
1 Parent(s): dcc3b18

Return play URL without blocking on duration

Browse files
Files changed (1) hide show
  1. server.js +0 -13
server.js CHANGED
@@ -2155,16 +2155,6 @@ async function handleGenerate(req, res, url) {
2155
  durCache.set(hid, fromHot);
2156
  }
2157
  }
2158
- if (!(durCache.get(hid) > 1) && !(Number(rec.duration) > 1)) {
2159
- try {
2160
- await Promise.race([
2161
- fillDuration(bot, rec, msgId),
2162
- new Promise((r) => setTimeout(r, 380))
2163
- ]);
2164
- } catch { }
2165
- } else {
2166
- fillDuration(bot, rec, msgId).catch(() => { });
2167
- }
2168
  const cachedDur = durCache.get(hid);
2169
  if (cachedDur > 1) rec.duration = cachedDur;
2170
  const playMime = httpVideoType(rec.mime, rec.name);
@@ -2234,9 +2224,6 @@ async function handleStream(req, res, url, msgId, kHex, ticketObj) {
2234
  res.writeHead(206, headersHot);
2235
  return res.end();
2236
  }
2237
- if (rngHot.start === 0 && inflightHot.has(String(msgId))) {
2238
- await waitHotHead(msgId, Math.min(262144, needHot), 220);
2239
- }
2240
  const hit = hotPrefix(msgId, rngHot.start, rngHot.end);
2241
  if (hit && hit.length >= needHot) {
2242
  if (res.socket) {
 
2155
  durCache.set(hid, fromHot);
2156
  }
2157
  }
 
 
 
 
 
 
 
 
 
 
2158
  const cachedDur = durCache.get(hid);
2159
  if (cachedDur > 1) rec.duration = cachedDur;
2160
  const playMime = httpVideoType(rec.mime, rec.name);
 
2224
  res.writeHead(206, headersHot);
2225
  return res.end();
2226
  }
 
 
 
2227
  const hit = hotPrefix(msgId, rngHot.start, rngHot.end);
2228
  if (hit && hit.length >= needHot) {
2229
  if (res.socket) {