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

source-twilio: capture messages updates based on lookback_window #2225

Merged
merged 2 commits into from
Dec 23, 2024

Conversation

Alex-Bair
Copy link
Contributor

@Alex-Bair Alex-Bair commented Dec 20, 2024

Description:

This PR's scope includes:

  • Removing the functionality that reduces incremental streams' states by lookback_window minutes.
  • Removing lookback_window from affecting the message_media stream. Media can't be added to messages after they're created, so it doesn't make sense to check previously created messages for new media.
  • Capturing updates to messages documents if they happen within the past lookback_window minutes.

Additional details:
Twilio's API only allows us to query messages based on their creation date date_sent, not their updated date date_updated. Previously, the connector was only getting creates, with the option to use the lookback_window config setting to push back the cursor value, causing all messages created in the past lookback_window minutes to get re-captured. The messages stream now uses the lookback window to query Twilio for messages created lookback_window minutes in the past, but it only captures messages that have been created or updated after the current cursor value.

Future work includes using lookback_window like this for the other incremental streams (calls, etc.) as appropriate to capture updates as well as creates. I didn't do those streams in this PR since they aren't the current issue & it'd take some additional time to make sure they work as intended.

Workflow steps:

(How does one use this feature, and how has it changed)

Documentation links affected:

(list any documentation links that you created, or existing ones that you've identified as needing updates, along with a brief description)

Notes for reviewers:

Tested on a local stack. Confirmed:

  • messages captures updates to records made in the past lookback_window minutes.
  • messages still captures creates.
  • message_media still functions incrementally.

Any users who want to use this functionality should set their lookback_window to a value greater than 0. For example, if a user only cares about updates to messages within the past day, they should set their task's lookback_window to 1440.


This change is Reviewable

…treams

No user's tasks are currently using the lookback window setting, so I'm
removing code that shifts incremental streams' states back based on the
lookback window. This is pre-positioning for future work that makes the
lookback window affect the date range over which we query Twilio's API
instead of mutating streams' states.
@Alex-Bair Alex-Bair force-pushed the bair/source-twilio-messages-updates branch 2 times, most recently from ba1925a to 10d1ff0 Compare December 20, 2024 20:22
@Alex-Bair Alex-Bair marked this pull request as ready for review December 20, 2024 20:22
@Alex-Bair Alex-Bair added the change:unplanned Unplanned change, useful for things like doc updates label Dec 20, 2024
Twilio's API only allows us to query messages based on their creation
date, not their updated date. Previously, the connector was only getting
creates, with the option to use the lookback window to push back the
cursor value to re-emit all messages created in the past X minutes. The
`messages` stream now uses the lookback window to query Twilio for
messages created X minutes in the past, but it only emits messages that
have been created or updated after the current cursor value.
@Alex-Bair Alex-Bair force-pushed the bair/source-twilio-messages-updates branch from 10d1ff0 to 91b89ab Compare December 20, 2024 22:06
Copy link
Member

@williamhbaker williamhbaker left a comment

Choose a reason for hiding this comment

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

LGTM

@Alex-Bair Alex-Bair merged commit 8fad862 into main Dec 23, 2024
74 of 81 checks passed
@Alex-Bair Alex-Bair deleted the bair/source-twilio-messages-updates branch December 23, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:unplanned Unplanned change, useful for things like doc updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants