Skip to content

Commit

Permalink
[connectors] Fix timeouts when syncing Zendesk articles (#8843)
Browse files Browse the repository at this point in the history
* perf: only fetch sections for the category when syncing articles

* perf: only fetch the necessary users when syncing articles
  • Loading branch information
aubin-tchoi authored Nov 22, 2024
1 parent b07d2db commit e415774
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions connectors/src/@types/node-zendesk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ declare module "node-zendesk" {
};
sections: {
list: () => Promise<ZendeskFetchedSection[]>;
listByCategory: (
categoryId: number
) => Promise<ZendeskFetchedSection[]>;
show: (
sectionId: number
) => Promise<{ response: Response; result: ZendeskFetchedSection }>;
Expand Down
7 changes: 5 additions & 2 deletions connectors/src/connectors/zendesk/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,11 @@ export async function syncZendeskArticleBatchActivity({
`[Zendesk] Processing ${articles.length} articles in batch`
);

const sections = await zendeskApiClient.helpcenter.sections.list();
const users = await zendeskApiClient.users.list();
const sections =
await zendeskApiClient.helpcenter.sections.listByCategory(categoryId);
const { result: users } = await zendeskApiClient.users.showMany(
articles.map((article) => article.author_id)
);

await concurrentExecutor(
articles,
Expand Down

0 comments on commit e415774

Please sign in to comment.