From 85a5d2a0e6cb5ceb826899d3e5cf3923d19727fb Mon Sep 17 00:00:00 2001 From: Aubin Date: Wed, 27 Nov 2024 18:05:30 +0100 Subject: [PATCH 1/5] :bug: --- connectors/src/connectors/zendesk/lib/zendesk_api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectors/src/connectors/zendesk/lib/zendesk_api.ts b/connectors/src/connectors/zendesk/lib/zendesk_api.ts index 3ea817f0b161..05c4db414189 100644 --- a/connectors/src/connectors/zendesk/lib/zendesk_api.ts +++ b/connectors/src/connectors/zendesk/lib/zendesk_api.ts @@ -231,7 +231,7 @@ export async function fetchRecentlyUpdatedArticles({ }); return { articles: response.articles, - hasMore: response.next_page !== null || response.articles.length === 0, + hasMore: response.next_page !== null && response.articles.length !== 0, endTime: response.end_time, }; } From 4d27614cb96d89f8ebd45c547c4e2c38c582f944 Mon Sep 17 00:00:00 2001 From: Aubin Date: Wed, 27 Nov 2024 18:07:34 +0100 Subject: [PATCH 2/5] :bug: --- connectors/src/connectors/zendesk/lib/zendesk_api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectors/src/connectors/zendesk/lib/zendesk_api.ts b/connectors/src/connectors/zendesk/lib/zendesk_api.ts index 05c4db414189..76ec0bf7c556 100644 --- a/connectors/src/connectors/zendesk/lib/zendesk_api.ts +++ b/connectors/src/connectors/zendesk/lib/zendesk_api.ts @@ -292,7 +292,7 @@ export async function fetchRecentlyUpdatedTickets( }); return { tickets: response.tickets, - hasMore: !response.end_of_stream, + hasMore: !response.end_of_stream && response.tickets.lenght !== 0, nextLink: response.after_url, }; } From ea3af1830a37b390e55678f1032fa939ac0e7f06 Mon Sep 17 00:00:00 2001 From: Aubin Date: Wed, 27 Nov 2024 18:11:19 +0100 Subject: [PATCH 3/5] enh: interrupt ticket batching if a null nextLink is received --- connectors/src/connectors/zendesk/lib/zendesk_api.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/connectors/src/connectors/zendesk/lib/zendesk_api.ts b/connectors/src/connectors/zendesk/lib/zendesk_api.ts index 76ec0bf7c556..0e65ac05850a 100644 --- a/connectors/src/connectors/zendesk/lib/zendesk_api.ts +++ b/connectors/src/connectors/zendesk/lib/zendesk_api.ts @@ -292,7 +292,10 @@ export async function fetchRecentlyUpdatedTickets( }); return { tickets: response.tickets, - hasMore: !response.end_of_stream && response.tickets.lenght !== 0, + hasMore: + !response.end_of_stream && + response.tickets.lenght !== 0 && + response.after_url !== null, nextLink: response.after_url, }; } From 2faeb560bcb7579327d919177ad50e49dd6c4ef0 Mon Sep 17 00:00:00 2001 From: Aubin Date: Wed, 27 Nov 2024 18:11:52 +0100 Subject: [PATCH 4/5] fix: fix a typo --- connectors/src/connectors/zendesk/lib/zendesk_api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectors/src/connectors/zendesk/lib/zendesk_api.ts b/connectors/src/connectors/zendesk/lib/zendesk_api.ts index 0e65ac05850a..0c3dd36b4572 100644 --- a/connectors/src/connectors/zendesk/lib/zendesk_api.ts +++ b/connectors/src/connectors/zendesk/lib/zendesk_api.ts @@ -294,7 +294,7 @@ export async function fetchRecentlyUpdatedTickets( tickets: response.tickets, hasMore: !response.end_of_stream && - response.tickets.lenght !== 0 && + response.tickets.length !== 0 && response.after_url !== null, nextLink: response.after_url, }; From ce435021c6598e48363cc59dd516cb21fa40f353 Mon Sep 17 00:00:00 2001 From: Aubin Date: Wed, 27 Nov 2024 18:14:54 +0100 Subject: [PATCH 5/5] misc: change the order in an AND --- connectors/src/connectors/zendesk/lib/zendesk_api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/connectors/src/connectors/zendesk/lib/zendesk_api.ts b/connectors/src/connectors/zendesk/lib/zendesk_api.ts index 0c3dd36b4572..97c0a73972a0 100644 --- a/connectors/src/connectors/zendesk/lib/zendesk_api.ts +++ b/connectors/src/connectors/zendesk/lib/zendesk_api.ts @@ -294,8 +294,8 @@ export async function fetchRecentlyUpdatedTickets( tickets: response.tickets, hasMore: !response.end_of_stream && - response.tickets.length !== 0 && - response.after_url !== null, + response.after_url !== null && + response.tickets.length !== 0, nextLink: response.after_url, }; }