Skip to content

Commit

Permalink
confluence: remove headers logging, handle rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
spolu committed Dec 4, 2024
1 parent 94ca872 commit 3186337
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions connectors/src/connectors/confluence/lib/confluence_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { isLeft } from "fp-ts/Either";
import * as t from "io-ts";

import { setTimeoutAsync } from "@connectors/lib/async_utils";
import { ExternalOAuthTokenError } from "@connectors/lib/error";
import {
ExternalOAuthTokenError,
ProviderWorkflowError,
} from "@connectors/lib/error";
import logger from "@connectors/logger/logger";

const CatchAllCodec = t.record(t.string, t.unknown); // Catch-all for unknown properties.
Expand Down Expand Up @@ -248,20 +251,16 @@ export class ConfluenceClient {
endpoint,
retryCount,
delayMs,
headers: Object.fromEntries(response.headers.entries()),
},
"[Confluence] Rate limit hit, retrying after delay"
);
await setTimeoutAsync(delayMs);
return this.request(endpoint, codec, retryCount + 1);
} else {
throw new ConfluenceClientError(
`Rate limit hit on confluence API more than ${MAX_RATE_LIMIT_RETRY_COUNT} times.`,
{
type: "http_response_error",
status: response.status,
data: { url: `${this.apiUrl}${endpoint}`, response },
}
throw new ProviderWorkflowError(
"confluence",
"Rate limit hit on confluence API more than 10 times.",
"rate_limit_error"
);
}
}
Expand Down

0 comments on commit 3186337

Please sign in to comment.