Skip to content

Commit

Permalink
source-hubspot-native: fix variable access bug
Browse files Browse the repository at this point in the history
Quick fix of a bug introduced by the ordering of the the logging statement in
`fetch_search_objects_modified_at`, where `result.total` is not available
initializing the variable in the first loop.
  • Loading branch information
williamhbaker committed Nov 4, 2024
1 parent cce16ee commit f71dc3c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions source-hubspot-native/source_hubspot_native/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,18 +645,6 @@ async def fetch_search_objects_modified_at(
"limit": limit,
}

# Log every 10,000 returned records, since there are 200 per page.
if round % 50 == 0:
log.info(
"fetching ids for records modified at instant",
{
"object_name": object_name,
"instant": modified,
"count": len(output_items),
"remaining": result.total,
}
)

result: SearchPageResult[CustomObjectSearchResult] = SearchPageResult[CustomObjectSearchResult].model_validate_json(
await http.request(log, url, method="POST", json=input)
)
Expand All @@ -670,6 +658,18 @@ async def fetch_search_objects_modified_at(
id_cursor = r.id
output_items.add((r.properties.hs_lastmodifieddate, str(r.id)))

# Log every 10,000 returned records, since there are 200 per page.
if round % 50 == 0:
log.info(
"fetching ids for records modified at instant",
{
"object_name": object_name,
"instant": modified,
"count": len(output_items),
"remaining": result.total,
}
)

if not result.paging:
break

Expand Down

0 comments on commit f71dc3c

Please sign in to comment.