-
Notifications
You must be signed in to change notification settings - Fork 10
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
Boresha Afya Fixes: Saving a Family takes more than 5mins #137
Conversation
public class HfSyncTaskIntentService extends SyncTaskIntentService { | ||
@Override | ||
protected void onHandleIntent(Intent intent) { | ||
HfTaskServiceHelper taskServiceHelper = HfTaskServiceHelper.getInstance(); | ||
taskServiceHelper.syncTasks(); | ||
SyncTaskWithClientEventsServiceJob.scheduleJobImmediately(SyncTaskWithClientEventsServiceJob.TAG); | ||
scheduleJob(SyncTaskWithClientEventsServiceJob.TAG, 15L, 5L); |
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.
Why not schedule the job periodically like in https://github.com/opensrp/opensrp-client-chw-hf/blob/master/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/interactor/LoginInteractor.java#L42
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.
seems to have a bug in scheduleJob()
method we are passing the start
param as a minute and matching the condition with milliseconds.
https://github.com/opensrp/opensrp-client-core/blob/d24dc795ad2e2583447ef59042c0afb0691ae154/opensrp-core/src/main/java/org/smartregister/job/BaseJob.java#L26
Line no 26 will always return false.
I think we need to convert start
to TimeUnit.MINUTES.toMillis(start)
in client-core library.
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.
Hi @owais-vd
Yes, it appears the comparison boolean toReschedule = start < TimeUnit.MINUTES.toMillis(15);
is evaluated as TimeUnit.MINUTES.toMinutes(15) < TimeUnit.MINUTES.toMillis(start)
.
Won't this always result to toReschedule
as true
?
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.
TimeUnit.MINUTES.toMinutes(15)
always return minutes no conversion would be done because we are converting minutes to minutes.
For example:
TimeUnit.MINUTES.toMinutes(15)
return 15
and TimeUnit.MINUTES.toMillis(15)
return 900000
. Therefore, toReschedule
will always true
.
Line no 26 should be changed to boolean toReschedule = TimeUnit.MINUTES.toMillis(start) < TimeUnit.MINUTES.toMillis(15);
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.
Yeah. The change makes sense
@owais-vd Can you provide a description on what the issue was and the fix? |
on the application load, |
Hi @owais-vd |
Hi, i didn't check with default scheduling periodically method. I'll check and confirm |
The branch cannot currently be merged with unverified commits in it's history and will require a re-write or force-merge |
- This prevents blocking the EventClient method during registration as discovered by Owais
@allan-on Kindly approve again. The difference is that I removed 2 unsigned commits by Owais. The following are the commits
|
close opensrp/opensrp-client-chw#2077, opensrp/opensrp-client-chw#2078