If you call blobs.want() on a blob, and it's not available, the callback will be queued, and then will be called when the blob is downloaded. (This is correct.) However, the callback is not given a true for the has parameter.
Example usage from patchwork's blob server:
sbot.blobs.want(hash, function(err, has) {
if (!has) return respond(res, 404, 'File not found')
//...
respondSource(res, sbot.blobs.get(hash), false)
})
If the blob was already present, then has is set to true. I think it also should be set to true if there's a waiting period, for consistency, and in case we ever put a timeout on want (in which case false would be a meaningful result for has).
(This API issue is why Patchwork will show broken image links sometimes. The has comes back false when the download completes, resulting in the 404 response.)
If you call
blobs.want()
on a blob, and it's not available, the callback will be queued, and then will be called when the blob is downloaded. (This is correct.) However, the callback is not given atrue
for thehas
parameter.Example usage from patchwork's blob server:
If the blob was already present, then
has
is set to true. I think it also should be set totrue
if there's a waiting period, for consistency, and in case we ever put a timeout onwant
(in which casefalse
would be a meaningful result forhas
).(This API issue is why Patchwork will show broken image links sometimes. The
has
comes back false when the download completes, resulting in the 404 response.)