Skip to content

Commit

Permalink
enh(zendesk): lower concurrency to 3 for fetching ticket comments (#8916
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 26, 2024
1 parent 3916441 commit cf71c08
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions connectors/src/connectors/zendesk/temporal/activities.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ModelId } from "@dust-tt/types";
import _ from "lodash";

import { isNodeZendeskForbiddenError } from "@connectors/connectors/zendesk/lib/errors";
import { syncArticle } from "@connectors/connectors/zendesk/lib/sync_article";
Expand Down Expand Up @@ -434,10 +435,20 @@ export async function syncZendeskTicketBatchActivity({

const users = await zendeskApiClient.users.list();

const res = await concurrentExecutor(
const comments = await concurrentExecutor(
tickets,
async (ticket) => {
const comments = await zendeskApiClient.tickets.getComments(ticket.id);
async (ticket) => zendeskApiClient.tickets.getComments(ticket.id),
{ concurrency: 3, onBatchComplete: heartbeat }
);

const res = await concurrentExecutor(
_.zip(tickets, comments),
async ([ticket, comments]) => {
if (!ticket || !comments) {
throw new Error(
`[Zendesk] Unreachable: Ticket or comments not found, ticket: ${ticket}, comments: ${comments}`
);
}

return syncTicket({
connectorId,
Expand Down

0 comments on commit cf71c08

Please sign in to comment.