Closed georgeliao closed 4 months ago
Attention: Patch coverage is 85.00000%
with 6 lines
in your changes are missing coverage. Please review.
Project coverage is 88.83%. Comparing base (
2a16af2
) to head (42d1612
).
Files | Patch % | Lines |
---|---|---|
include/multipass/async_periodic_download_task.h | 85.18% | 4 Missing :warning: |
include/multipass/exceptions/base_qexception.h | 71.42% | 2 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hey @georgeliao, thanks for the work on this!
Would you be able to edit the PR description to link the github issues that this fixes in the format 'Fixes #xxxx'? That way I can get some more context on what behavior this is fixing.
Thanks!
@sharder996 , sorry that I forgot it, the link is added now. I also added more text in the intro to explain the context. Be free to ask any questions if something is not clear.
fix #3464
This PR adds binary exponential backoff based retry mechanism to async periodic download tasks, the checking exception (download failure an exception) in the main thread is done in a non-blocking fashion via
QFutureWatcher
.std::async
+std::future
pair toQtConcurrent::run
+QFuture
in order to use some QFuture specific features.QFutureWatcher
to watchQFuture
and react correspondingly in the successful and failed cases when QFuture is finished.DownloadException
to a QException-based class so it can cross the qt thread boundary.BaseQException
class to reuse the boilerplate code for all the QException derived classes.To test the behavior, you can modify the default delay time in
daemon.h
line 222 to a small number, so the download will run more frequently. After that, the wifi network can be manually turned off in ubuntu settings, which in a way causes download failure.