File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,7 @@ void Blob::Reader::Pull(const FunctionCallbackInfo<Value>& args) {
352352 Environment* env;
353353 std::vector<DataQueue::Vec> vecs;
354354 std::list<bob::Done> dones;
355+ size_t byte_count = 0;
355356 bool innext = false;
356357 };
357358 // TODO(@jasnell): A unique_ptr is likely better here but making this a unique
@@ -380,24 +381,26 @@ void Blob::Reader::Pull(const FunctionCallbackInfo<Value>& args) {
380381 if (count > 0) {
381382 impl->vecs.insert(impl->vecs.end(), vecs, vecs + count);
382383 impl->dones.push_back(std::move(doneCb));
384+ for (size_t n = 0; n < count; n++) impl->byte_count += vecs[n].len;
383385 }
384386 if (impl->innext) {
385387 CHECK(status != bob::STATUS_WAIT);
386388 return;
387389 }
388- if (status == bob::STATUS_CONTINUE) {
390+ if (status == bob::STATUS_CONTINUE && impl->byte_count < 16384 ) {
389391 // We pull some more,
390392 // but it must be sync as we
391393 // merge it together
392394 impl->innext = true;
393- while (status == bob::STATUS_CONTINUE) {
395+ while (status == bob::STATUS_CONTINUE && impl->byte_count < 16384 ) {
394396 auto snext = [impl](int status,
395397 const DataQueue::Vec* vecs,
396398 size_t count,
397399 bob::Done doneCb) {
398400 if (count > 0) {
399401 impl->vecs.insert(impl->vecs.end(), vecs, vecs + count);
400402 impl->dones.push_back(std::move(doneCb));
403+ for (size_t n = 0; n < count; n++) impl->byte_count += vecs[n].len;
401404 }
402405 };
403406 status = impl->reader->inner_->Pull(
You can’t perform that action at this time.
0 commit comments