Skip to content

Commit

Permalink
Hourly sync - Sync immediately when app starts (fixes #393) (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
Catfriend1 authored Apr 27, 2019
1 parent 0ca5d85 commit eb35171
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ private class SyncConditionResult {
* Only relevant if the user has enabled turning Syncthing on by
* time schedule for a specific amount of time periodically.
* Holds true if we are within a "SyncthingNative should run" time frame.
* Initial status true because we like to sync on app start, too.
*/
private Boolean mTimeConditionMatch = false;
private Boolean mTimeConditionMatch = true;

@Inject
SharedPreferences mPreferences;
Expand Down Expand Up @@ -165,7 +166,11 @@ public RunConditionMonitor(Context context,
updateShouldRunDecision();

// Initially schedule the SyncTrigger job.
JobUtils.scheduleSyncTriggerServiceJob(context, Constants.WAIT_FOR_NEXT_SYNC_DELAY_SECS);
JobUtils.scheduleSyncTriggerServiceJob(context,
mTimeConditionMatch ?
Constants.TRIGGERED_SYNC_DURATION_SECS :
Constants.WAIT_FOR_NEXT_SYNC_DELAY_SECS
);
}

public void shutdown() {
Expand Down

0 comments on commit eb35171

Please sign in to comment.