Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Before calling _blazorDownloadFileBuffersPush should the existing buffers be cleared first #16

Closed
Smurf-IV opened this issue Jul 29, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@Smurf-IV
Copy link

If the previous download had been cancelled (e.g. Due to a user moving away from the page etc),
then the next call to
await DownloadFileService.DownloadFile(fileDetails.OriginalFileName, stream, cancellationToken, cancellationToken, bufferSize: 32*1024);
Would also include the previous files buffers ?

@arivera12
Copy link
Owner

arivera12 commented Jul 29, 2020

This is something is left open for the developers to manage when they are using the AddBuffer method.

There is a ClearBuffers method which manage this.

Every time you call DownloadFile and runs entirely, the buffers gets cleared automatically after execution is completed.

If something is appended to the buffer it's not cleared by default, on navigating out side of the page I could catch that one, but if a task is cancelled by cancellation token does developer should get notified that the execution of the method have been canceled?

I don't see any other way to handle this.

The buffered method I think it could handle this by default, but the method that are not buffered could makes sense clear buffer before executing the JavaScript part.

I will think and analyze it in the weekend to see where and where not should go.

@arivera12 arivera12 self-assigned this Jul 29, 2020
@arivera12 arivera12 added the enhancement New feature or request label Jul 29, 2020
@Smurf-IV
Copy link
Author

The _blazorDownloadFileBuffersPush is used internally for when downloading the whole file.
Knowledge of the internals is not known.

the buffers gets cleared automatically after execution is completed

The example of cancellation is not classed a completion.

Therefore the "whole file" method needs to call clearBuffers before starting any Add####.

@arivera12
Copy link
Owner

The _blazorDownloadFileBuffersPush is used internally for when downloading the whole file.

Not in all cases

Therefore the "whole file" method needs to call clearBuffers before starting any Add####.

I will analyze where and where not this make sense to be done.

arivera12 pushed a commit that referenced this issue Aug 1, 2020
… get cleared automatically. Improved DownloadBase64Buffers and DownloadBinaryBuffers methods documentation. Added clear buffers in methods that pushes into buffer before loading the new buffers to preven duplicates on any kind of situation. Adds enhancement #16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants