Skip to content

Commit

Permalink
fix(zendesk): only fetch comment authors (#8935)
Browse files Browse the repository at this point in the history
Co-authored-by: Henry Fontanier <[email protected]>
  • Loading branch information
fontanierh and Henry Fontanier authored Nov 27, 2024
1 parent b0af32e commit ab30fa5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions connectors/src/connectors/zendesk/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,18 @@ export async function syncZendeskTicketBatchActivity({
return { hasMore: false, nextLink: "" };
}

const users = (await zendeskApiClient.users.list()) || [];

const comments = await concurrentExecutor(
const comments2d = await concurrentExecutor(
tickets,
async (ticket) => zendeskApiClient.tickets.getComments(ticket.id),
{ concurrency: 3, onBatchComplete: heartbeat }
);
const userIds = _.uniq(
_.flatten(comments2d.map((comments) => comments.map((c) => c.author_id)))
);
const { result: users } = await zendeskApiClient.users.showMany(userIds);

const res = await concurrentExecutor(
_.zip(tickets, comments),
_.zip(tickets, comments2d),
async ([ticket, comments]) => {
if (!ticket || !comments) {
throw new Error(
Expand Down

0 comments on commit ab30fa5

Please sign in to comment.