There is an issue with .pause/.resume
See original GitHub issueI heavily rely on pause-resume methods. I use chunk-streaming processing and here is what I’ve found: https://github.com/mholt/PapaParse/blob/master/papaparse.js#L403
else if (isFunction(this._config.chunk))
{
this._config.chunk(results, this._handle);
if (this._paused)
return;
results = undefined;
}
this._paused
is always false in this context. It has to be checked by this._handle.paused()
Another part of the issue is in the resume implementation, but let’s look at pause
method at first:
this.pause = function()
{
_paused = true;
_parser.abort();
_input = _input.substr(_parser.getCharIndex());
};
_input
will be always an empty string (!) if we use chunk-streaming. On resume, PapaParse will parse the empty string again and will fire callbacks with empty results.
My JavaScript code is not that good, which is why I’m creating this issue instead of a pull request, but here is my attempt to patch the issue:
@@ -367,6 +367,12 @@
this.parseChunk = function(chunk)
{
+ if (chunk.length === 0) {
+ // It is possible due to the pause/resume implementation.
+ this._nextChunk();
+ return;
+ }
+
// Rejoin the line we likely just split in two by chunking the file
var aggregate = this._partialLine + chunk;
this._partialLine = "";
@@ -400,7 +406,7 @@
else if (isFunction(this._config.chunk))
{
this._config.chunk(results, this._handle);
- if (this._paused)
+ if (this._handle.paused())
return;
results = undefined;
}
Issue Analytics
- State:
- Created 9 years ago
- Comments:19 (6 by maintainers)
Top Results From Across the Web
Fix Printer Status is Paused, Cannot Resume error in ...
If your Printer Status is Paused and Cannot Resume, you need to disable 'Pause Printing'. Here are some more fixes to resolve the...
Read more >Fix Printer Status is Paused, Cannot Resume error ... - YouTube
Some Windows users are reporting that when their printer pauses and stops printing. Therefore, in this article, we will be talking about ...
Read more >How to Pause and Resume sync in OneDrive - Microsoft Support
To Resume syncing · Tap the paused OneDrive icon in the notification/menu area: · In the activity center, select More again and select...
Read more >Pause and resume is dead - CardEasy
It's only one part of a complicated set of PCI DSS compliance requirements · It doesn't sit well with your customer service or...
Read more >Distribution Pause / Resume Page - IBM
If the pause record is in this status and the date and time in last updated column is not actively updating, there might...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
After more testing, it appears the issues with
step
are not exactly the same as withchunk
. Changing my above code to usechunk
makes it work after the fix from #479 is applied. Butstep
still doesn’t work.@mrksbnch I have the same problem, busy with projects… I’ll see if I find some time and I’ll keep this topic updated if I find something