Skip to content

Commit

Permalink
source-braintree-native: change window size from days to hours
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Bair committed Dec 9, 2024
1 parent 164238c commit 81ce6e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions source-braintree-native/source_braintree_native/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def fetch_transactions(
) -> AsyncGenerator[IncrementalResource | LogCursor, None]:
assert isinstance(log_cursor, datetime)
most_recent_created_at = log_cursor
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.transaction.search(
Expand Down Expand Up @@ -129,7 +129,7 @@ async def fetch_customers(
) -> AsyncGenerator[IncrementalResource | LogCursor, None]:
assert isinstance(log_cursor, datetime)
most_recent_created_at = log_cursor
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.customer.search(
Expand Down Expand Up @@ -163,7 +163,7 @@ async def fetch_credit_card_verifications(
) -> AsyncGenerator[IncrementalResource | LogCursor, None]:
assert isinstance(log_cursor, datetime)
most_recent_created_at = log_cursor
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.verification.search(
Expand Down Expand Up @@ -197,7 +197,7 @@ async def fetch_subscriptions(
) -> AsyncGenerator[IncrementalResource | LogCursor, None]:
assert isinstance(log_cursor, datetime)
most_recent_created_at = log_cursor
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.subscription.search(
Expand Down Expand Up @@ -234,7 +234,7 @@ async def fetch_disputes(
# The start date must be shifted back 1 day since we have to query Braintree using the received_date field,
# which is less granular than the created_at cursor field (date vs. datetime).
start = log_cursor - timedelta(days=1)
window_end = log_cursor + timedelta(days=window_size)
window_end = log_cursor + timedelta(hours=window_size)
end = min(window_end, datetime.now(tz=UTC))

collection = braintree_gateway.dispute.search(
Expand Down
4 changes: 2 additions & 2 deletions source-braintree-native/source_braintree_native/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class Advanced(BaseModel):
default=False,
)
window_size: Annotated[int, Field(
description="Window size in days for incremental streams. This should be left as the default value unless connector errors indicate a smaller window size is required.",
description="Window size in hours for incremental streams. This should be left as the default value unless connector errors indicate a smaller window size is required.",
title="Window Size",
default=15,
default=24,
gt=0,
)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"type": "boolean"
},
"window_size": {
"default": 15,
"description": "Window size in days for incremental streams. This should be left as the default value unless connector errors indicate a smaller window size is required.",
"default": 24,
"description": "Window size in hours for incremental streams. This should be left as the default value unless connector errors indicate a smaller window size is required.",
"exclusiveMinimum": 0,
"title": "Window Size",
"type": "integer"
Expand Down

0 comments on commit 81ce6e0

Please sign in to comment.