Skip to content

Commit

Permalink
feat: Add requestTimeout to avoid long running queries
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Aug 23, 2024
1 parent cee4d5b commit a02a477
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { v4 as uuid } from 'uuid';
import { OAuth2Client, generateCodeVerifier } from '@badgateway/oauth2-client';
import defaultAxios from 'axios';
import type { AxiosInstance, AxiosResponse } from 'axios';
import { RequiredParameterMissingError, OAuthError } from './errors.js';
import { URLS } from './urls.js';
import defaultAxios from 'axios';
import { v4 as uuid } from 'uuid';
import { OAuthError, RequiredParameterMissingError } from './errors.js';
import type {
AuthState,
AuthorizationData,
Document,
InitParams,
AuthorizationData,
MCUser,
MCProject,
MCDocument,
MCProject,
MCUser,
} from './types.js';
import { URLS } from './urls.js';

const defaultBaseURL = 'https://www.mermaidchart.com'; // "http://127.0.0.1:5174"
const authorizationURLTimeout = 60_000;
const requestTimeout = 5000;

export class MermaidChart {
private clientID: string;
Expand Down Expand Up @@ -52,6 +53,7 @@ export class MermaidChart {
});
this.axios = defaultAxios.create({
baseURL: this.#baseURL,
timeout: requestTimeout,
});

this.axios.interceptors.response.use((res: AxiosResponse) => {
Expand Down

0 comments on commit a02a477

Please sign in to comment.