Commit e335ffa5bc6c1a847bbb992f930f62c780d3b244
Hard-code workaround for large blob
cel committed on 11/29/2019, 9:52:48 PMParent: 5eeba2c58721e0dda8b9b829f4b3feb22e7a9a26
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -384,8 +384,16 @@ | |||
384 | 384 … | var blobs = sbot.blobs | |
385 | 385 … | blobs.size(id, function (err, size) { | |
386 | 386 … | if (err && err.code !== 'ENOENT') return cb(err) | |
387 | 387 … | if (typeof size === 'number') return cb(null, blobs.get(id), size) | |
388 … | + if (id === '&pSqSdJEJMxbUiDWMNRd1RP47m5M1MD4IeasDYY4jrwg=.sha256') { | ||
389 … | + // sodium-native v2.4.6 (12M) | ||
390 … | + return getLargeBlob(sbot, [ | ||
391 … | + '&d+J8NSPD1QRMLtLkyoRgq3ShPpqsgzCGUOTh+U6wPH0=.sha256', | ||
392 … | + '&u4Ih2XRhQmWw5FElWjK1weSuDBn8hfSVn96lFbJHts0=.sha256', | ||
393 … | + '&kW4d1Dz1sm0Y4az+qXPkcew3+LD6Om5+06STSihRWMk=.sha256' | ||
394 … | + ], cb) | ||
395 … | + } | ||
388 | 396 … | var timeout = wantWarnTime > 0 && setTimeout(function () { | |
389 | 397 … | console.error('Blob taking a long time to fetch:', id) | |
390 | 398 … | }, wantWarnTime) | |
391 | 399 … | blobs.want(id, function (err, got) { | |
@@ -399,8 +407,25 @@ | |||
399 | 407 … | }) | |
400 | 408 … | }) | |
401 | 409 … | } | |
402 | 410 … | ||
411 … | +function getLargeBlob(sbot, ids, cb) { | ||
412 … | + var done = multicb({pluck: 1}) | ||
413 … | + var totalSize = 0 | ||
414 … | + ids.forEach(function (id) { | ||
415 … | + var cb = done() | ||
416 … | + getBlob(sbot, id, function (err, source, size) { | ||
417 … | + if (err) return cb(err) | ||
418 … | + totalSize += size | ||
419 … | + cb(null, source) | ||
420 … | + }) | ||
421 … | + }) | ||
422 … | + done(function (err, sources) { | ||
423 … | + if (err) return cb(err) | ||
424 … | + cb(null, cat(sources), totalSize) | ||
425 … | + }) | ||
426 … | +} | ||
427 … | + | ||
403 | 428 … | function getMentions(links2, name) { | |
404 | 429 … | return links2.read({ | |
405 | 430 … | query: [ | |
406 | 431 … | {$filter: {rel: ['mentions', name, {$gt: true}]}}, |
Built with git-ssb-web