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

Add lookback duration for engagements #91

Merged
merged 5 commits into from
May 20, 2019
Merged

Conversation

dmosorast
Copy link
Contributor

@dmosorast dmosorast commented May 17, 2019

This is a strange situation that can arise when records are vigorously updated while syncing the engagements stream. There are a few things that contribute to this, given the syncing strategy:

  1. There's no way to query based on lastUpdated, so the full data set must be inspected each run, and records emitted based on bookmark value.
  2. Because of this, the max_bookmark is saved through each run and written to state after the whole dataset has been seen.
  3. The recordset isn't frozen with the first request, like some pagination strategies, so records may be updated out of the time range as the sync progresses.

The Situation

The effect of that is this potential situation:

T0: Start engagements sync
T1: Get record R1 and sync, update max_bookmark to R1[lastUpdated]
T2: Record R1 is updated
T3: Record R2 is updated
T4: Sync record R2, update max_bookmark to R2[lastUpdated]
T5: Finish engagements sync and save max_bookmark to emit records from for the next time around

In this situation, the update to record R1 that occurred at T2 is skipped on the next sync, since it's lastUpdated value is lower than the bookmark, saved from T2 as "max".

Mitigation

In order to mitigate this, the duration of the engagements sync is stored in STATE under last_sync_duration, when present, this value will determine the amount of time (in seconds) that the bookmark should be pushed towards the past to catch any records that were updated as described above.

@dmosorast dmosorast merged commit c2bb3b0 into master May 20, 2019
@dmosorast dmosorast deleted the fix/lookback-on-engagements branch May 20, 2019 15:04
mdimercurio added a commit to dialoguemd-archives/tap-hubspot that referenced this pull request Jun 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant