-
Notifications
You must be signed in to change notification settings - Fork 499
Add network connected constraint to DataDonationAnalyticsWorker (EXPOSUREAPP-5286) #2431
Add network connected constraint to DataDonationAnalyticsWorker (EXPOSUREAPP-5286) #2431
Conversation
Signed-off-by: Kolya Opahle <k.opahle@sap.com>
@@ -25,5 +27,11 @@ class DataDonationAnalyticsWorkBuilder @Inject constructor() { | |||
BackgroundConstants.BACKOFF_INITIAL_DELAY, | |||
TimeUnit.MINUTES | |||
) | |||
.setConstraints(buildConstraints()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to add a log if the worker wasn't started due to the network constraint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we can, the work is scheduled by the WorkManager api and if there is no network connection the worker is simply not spawned, i don't think we get any kind of callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could maybe remove the constraint and do the check inside of the worker ourselves but i think this kind of defeats the purpose of the work manager in the first place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos, SonarCloud Quality Gate passed! |
Description
This PR adds a network connected constraint to the work builder of the DataDonationAnalyticsWorker as we cannot proceed with analytics donation without a network connection there is no need to enqueue work in that case
Steps to reproduce