Comments (2)
I think I see the problem... Reporting is done using the System.Progress<T>
class. As can be read here these events are send to the synchronization context of the Progress<T>
object during construction. This is the actual call that is being invoked when you call Progress.Report(...):
/// <summary>Reports a progress change.</summary>
/// <param name="value">The value of the updated progress.</param>
void IProgress<T>.Report(T value) { OnReport(value); }
/// <summary>Reports a progress change.</summary>
/// <param name="value">The value of the updated progress.</param>
protected virtual void OnReport(T value)
{
// If there's no handler, don't bother going through the sync context.
// Inside the callback, we'll need to check again, in case
// an event handler is removed between now and then.
Action<T>? handler = _handler;
EventHandler<T>? changedEvent = ProgressChanged;
if (handler != null || changedEvent != null)
{
// Post the processing to the sync context.
// (If T is a value type, it will get boxed here.)
_synchronizationContext.Post(_invokeHandlers, value);
}
}
As you can see, it will perform a Post(...)
on the synchronization context and that means that it will be invoked asynchronously. A Post(...)
is a kind of fire-and-forget mechanism. So if your code runs fast, then the progress update is still in the queue and waiting to be dispatched, but the upload is already finished.
from minio-dotnet.
The reason that MS decided to use asynchronous posting of events in System.Progress<T>
is probably, because progress is often used to provide feedback to the user. Most UI frameworks (at least WinForms and WPF) require that all UI updates are done on the main-thread. Because progress updates are normally not needed to be done in real-time (it doesn't matter that a progress updates is a few milliseconds late), using the SynchronizationContext
is very convenient in UI applications.
The reason that they choose to Post()
instead of Send()
is not to block the caller. If they would have used Send()
, then the call will be called synchronously on the progress thread and that would block processing and slow it down.
In a unit-test, there is no need for thread-synchronisation and using a callback that is invoked on an arbitrary thread is just fine.
from minio-dotnet.
Related Issues (20)
- Upload and download use WithSSL()
- Latest version of `regitlint` raises a lot of errors HOT 1
- NullReferenceException thrown when using PutObjectAsync
- PutObjectAsync doesn't handle an 'Access Denied' specific case after upgrade to 6.0.3 HOT 2
- BucketExistsAsync seems to need a bit of refactoring HOT 1
- STS authentication doesn't seem to deal with slight time deviations
- ListBucketsAsync should throw exception when the server is not online or response.status is not ok HOT 2
- High memory usage for PutObjectAsync with Streams
- `ListenBucketNotificationAsync` Test1, Test2 and Test3` needs to be cleaned up.
- Ensure `ListenNotifications` not returning before it started listening
- copy deeply error CopyObjectAsync HOT 5
- Can you provide support for shard uploading? I found that Java Go libraries already support it. If possible, thank you very much HOT 1
- Support for keyed services
- Content-Type header value is wrong in the presigned put url HOT 1
- Bug | SDK does not throw exceptions for upload errors HOT 2
- Agent impact on `ListObjectsAsync` HOT 3
- After the file upload is completed, the local file is still occupied
- CopyObjectAsync memory leak
- Support using PutObjectAsync return a HttpStatusCode and throw Exception when StatusCode not equal 200 HOT 1
- Status code in `PutObjectResponse` is internal, unlike AWS S3's implementation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minio-dotnet.