Skip to content
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

feat: Using config to decide base query or delta query #386

Merged
merged 1 commit into from
Apr 22, 2020

Conversation

wooj2
Copy link
Contributor

@wooj2 wooj2 commented Apr 14, 2020

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@wooj2 wooj2 requested a review from palpatim April 14, 2020 20:27
@wooj2 wooj2 added the datastore Issues related to the DataStore category label Apr 14, 2020
@wooj2 wooj2 requested a review from jamesonwilliams April 15, 2020 03:21
@@ -54,7 +54,19 @@ final class InitialSyncOperation: AsynchronousOperation {
}

let lastSyncMetadata = getLastSyncMetadata()
lastSyncTime = lastSyncMetadata?.lastSync
if let lastSync = lastSyncMetadata?.lastSync {
let lastSyncDate = Date(timeIntervalSince1970: TimeInterval(lastSync) / 1_000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be convenient to extend @drochetti's TimeInterval extension that provides unit-based constructors with a milliseconds so you could just do lastSyncDate = Date(timeIntervalSince1970: TimeInterval.milliseconds(lastSync))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm yes, this would be cool. This is not currently in master, so adding a todo, and

if let lastSync = lastSyncMetadata?.lastSync {
let lastSyncDate = Date(timeIntervalSince1970: TimeInterval(lastSync) / 1_000)
let secondsSinceLastSync = (lastSyncDate.timeIntervalSinceNow * -1)
if secondsSinceLastSync < 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just if lastSyncDate > Date() { ... assume base query ... } ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at doing this, but I need secondsSinceLastSync a couple lines down to determine if we should do a delta query.

@wooj2 wooj2 force-pushed the feature/datastore-config-configPass-sIntv branch from bf03452 to 02a09e7 Compare April 17, 2020 19:33
@wooj2 wooj2 force-pushed the feature/datastore-config-configPass branch from 60f222b to 9111186 Compare April 21, 2020 20:17
@wooj2 wooj2 force-pushed the feature/datastore-config-configPass-sIntv branch from 02a09e7 to ea5f132 Compare April 21, 2020 20:32
@wooj2 wooj2 changed the base branch from feature/datastore-config-configPass to master April 21, 2020 21:16
Copy link
Member

@palpatim palpatim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider a backlog item for the TODO, otherwise LGTM

@wooj2 wooj2 force-pushed the feature/datastore-config-configPass-sIntv branch from ea5f132 to 52bd777 Compare April 22, 2020 17:42
@wooj2 wooj2 force-pushed the feature/datastore-config-configPass-sIntv branch from 52bd777 to 058da3e Compare April 22, 2020 17:43
@wooj2 wooj2 changed the title Using config to decide base query or delta query feat: Using config to decide base query or delta query Apr 22, 2020
@wooj2 wooj2 merged commit b02c3b7 into master Apr 22, 2020
@wooj2 wooj2 deleted the feature/datastore-config-configPass-sIntv branch April 22, 2020 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore Issues related to the DataStore category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants