fix(printer): increase timeout to 15s

This commit is contained in:
Amruth Pillai
2023-11-14 16:06:16 +01:00
parent 36b1930c0d
commit 457aed5f46
6 changed files with 28 additions and 34 deletions

View File

@ -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(),
// URLs
PUBLIC_URL: z.string().url(),

View File

@ -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),
);
}

View File

@ -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 Locale
data.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 {