From 7e58edb126e2277e8f9d8b1c4045281bd58dd6f5 Mon Sep 17 00:00:00 2001 From: Will Baker Date: Mon, 4 Nov 2024 16:16:28 -0500 Subject: [PATCH] source-hubspot-native: fix variable access bug 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. --- .../source_hubspot_native/api.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source-hubspot-native/source_hubspot_native/api.py b/source-hubspot-native/source_hubspot_native/api.py index aa1d15b3f..526ee8de7 100644 --- a/source-hubspot-native/source_hubspot_native/api.py +++ b/source-hubspot-native/source_hubspot_native/api.py @@ -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) ) @@ -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