Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confluence: remove headers logging, handle rate limit #9135

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading