algoliasearch/src/offline/java/com/algolia/search/saas/MirroredIndex.java
public void syncIfNeeded()
    {
        long currentDate = System.currentTimeMillis();
        if (currentDate - mirrorSettings.getLastSyncDate().getTime() > delayBetweenSyncs || mirrorSettings.getQueriesModificationDate().compareTo(mirrorSettings.getLastSyncDate()) > 0) {
            sync();
        }
    }
public void syncIfNeeded()
    {
        long currentDate = System.currentTimeMillis();
        if (currentDate - mirrorSettings.getLastSyncDate().getTime() > delayBetweenSyncs || mirrorSettings.getQueriesModificationDate().compareTo(mirrorSettings.getLastSyncDate()) > 0) {
            sync();
        }
    }
Launch a sync only if the data is obsolete.
The data is obsolete if the last successful sync is older than the delay between syncs, or if the data selection
queries have been changed in the meantime.

@throws IllegalStateException If no data selection queries were set.