docs(core): Add flush
-related docstrings and comments
#3789
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the process of trying to solve the problem of broken nextjs API routes on Vercel, I had to dig into the flush code, to figure out if it was causing the problems we were seeing. Spoiler alert: It wasn't. But since I'd already annotated the code for myself, I figured I might as well spare the next reader of that code some time if possible.
In addition to docstrings and comments, the only changes are:
_isClientProcessing
/_isClientDoneProcessing
: This resolves totrue
when processing is done, andfalse
if processing is still happening, which is the opposite of what the original name implied._processing
/_numProcessing
: Since it represents a number, might as well make that obvious in the name, lest the casual reader think it might be a boolean or a collection of things currently being processed.ready
/clientFinished
inflush
: This provides a nice parallel totransportFlushed
. Also, the client may well be "ready," but since this is mostly called as part of a shutdown procedure, the fact that it's ready matters less than the fact that it's finished with the work it was doing.