A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix(printer): increase timeout to 15s
Amruth Pillai457aed5f46e1
diff --git a/apps/client/src/libs/axios.ts b/apps/client/src/libs/axios.tsindex 7b1e8ae1f..ddfd63afe 100644--- a/apps/client/src/libs/axios.ts+++ b/apps/client/src/libs/axios.ts@@ -1,5 +1,5 @@import { t } from "@lingui/macro";-import { deepSearchAndParseDates } from "@reactive-resume/utils";+import { deepSearchAndParseDates, ErrorMessage } from "@reactive-resume/utils";import _axios from "axios";import createAuthRefreshInterceptor from "axios-auth-refresh";import { redirect } from "react-router-dom";@@ -25,13 +25,16 @@ axios.interceptors.response.use(return { ...response, data: transformedResponse };},(error) => {- const message = error.response?.data.message || error.message;+ const message = error.response?.data.message as ErrorMessage;+ const description = translateError(message);- toast({- variant: "error",- title: t`Oops, the server returned an error.`,- description: translateError(message),- });+ if (description) {+ toast({+ variant: "error",+ title: t`Oops, the server returned an error.`,+ description,+ });+ }return Promise.reject(error);},diff --git a/apps/client/src/services/errors/translate-error.ts b/apps/client/src/services/errors/translate-error.tsindex 5266009ec..f8beb9400 100644--- a/apps/client/src/services/errors/translate-error.ts+++ b/apps/client/src/services/errors/translate-error.ts@@ -41,6 +41,6 @@ export const translateError = (error: ErrorMessage) => {return t`Something went wrong while processing your request. Please try again later or raise an issue on GitHub.`;default:- return error;+ return null;}};diff --git a/apps/server/src/config/schema.ts b/apps/server/src/config/schema.tsindex eaf104699..1a88394e8 100644--- a/apps/server/src/config/schema.ts+++ b/apps/server/src/config/schema.ts@@ -7,8 +7,8 @@ export const configSchema = z.object({PORT: z.coerce.number().default(3000),// Client Port & URL (only for development environments)- __DEV__CLIENT_PORT: z.coerce.number().default(5173),- __DEV__CLIENT_URL: z.string().url().default("http://localhost:5173"),+ __DEV__CLIENT_PORT: z.coerce.number().optional(),+ __DEV__CLIENT_URL: z.string().url().optional(),// URLsPUBLIC_URL: z.string().url(),diff --git a/apps/server/src/printer/printer.service.ts b/apps/server/src/printer/printer.service.tsindex 69d102dc6..a4a3f1f4a 100644--- a/apps/server/src/printer/printer.service.ts+++ b/apps/server/src/printer/printer.service.ts@@ -14,7 +14,7 @@ import { Config } from "../config/schema";import { StorageService } from "../storage/storage.service";import { UtilsService } from "../utils/utils.service";-const PRINTER_TIMEOUT = 10000; // 10 seconds+const PRINTER_TIMEOUT = 15000; // 15 seconds@Injectable()export class PrinterService {@@ -76,9 +76,7 @@ export class PrinterService {async printPreview(resume: ResumeDto) {return this.utils.getCachedOrSet(`user:${resume.userId}:storage:previews:${resume.id}`,- async () => {- return withTimeout(this.generatePreview(resume), PRINTER_TIMEOUT);- },+ async () => withTimeout(this.generatePreview(resume), PRINTER_TIMEOUT),);}diff --git a/apps/server/src/translation/translation.service.ts b/apps/server/src/translation/translation.service.tsindex 221a74654..39365aff4 100644--- a/apps/server/src/translation/translation.service.ts+++ b/apps/server/src/translation/translation.service.ts@@ -22,8 +22,6 @@ export class TranslationService {) {}async fetchLanguages() {- const isDevelopment = this.configService.get("NODE_ENV") === "development";-try {const projectId = this.configService.getOrThrow("CROWDIN_PROJECT_ID");const accessToken = this.configService.getOrThrow("CROWDIN_ACCESS_TOKEN");@@ -34,6 +32,7 @@ export class TranslationService {);const { data } = response.data as CrowdinResponse;+ // Add English Localedata.push({data: {language: {@@ -46,19 +45,18 @@ export class TranslationService {},});- if (isDevelopment) {- data.push({- data: {- language: {- id: "zu-ZA",- locale: "zu-ZA",- editorCode: "zuza",- name: "Psuedo Locale",- },- translationProgress: 100,+ // Add Pseudo Locale+ data.push({+ data: {+ language: {+ id: "zu-ZA",+ locale: "zu-ZA",+ editorCode: "zuza",+ name: "Psuedo Locale",},- });- }+ translationProgress: 100,+ },+ });return data.map(({ data }) => {return {diff --git a/libs/utils/src/namespaces/promise.ts b/libs/utils/src/namespaces/promise.tsindex ebc720f59..95518334e 100644--- a/libs/utils/src/namespaces/promise.ts+++ b/libs/utils/src/namespaces/promise.ts@@ -1,11 +1,6 @@export const delay = (time: number) => new Promise((resolve) => setTimeout(resolve, time));export const withTimeout = async <T>(promise: Promise<T>, time: number): Promise<T> => {- const timeout = new Promise((_, reject) =>- setTimeout(() => {- reject(new Error(`Operation timed out after ${time} ms.`));- }, time),- );-+ const timeout = new Promise((_, reject) => setTimeout(() => reject, time));return Promise.race([promise, timeout]) as T;};