pin browserless/chrome version as latest it too unstable

This commit is contained in:
Amruth Pillai
2023-11-14 21:53:10 +01:00
parent 044ef8bdb5
commit 72852f90e2
10 changed files with 16 additions and 18 deletions

View File

@ -13,7 +13,6 @@ export const configSchema = z.object({
// URLs
PUBLIC_URL: z.string().url(),
STORAGE_URL: z.string().url(),
CHROME_URL: z.string().url(),
// Database (Prisma)
DATABASE_URL: z.string().url().startsWith("postgresql://"),
@ -24,6 +23,7 @@ export const configSchema = z.object({
// Browser
CHROME_TOKEN: z.string(),
CHROME_URL: z.string().url(),
// Mail Server
SMTP_URL: z.string().url().startsWith("smtp://").optional(),

View File

@ -14,13 +14,13 @@ import { Config } from "../config/schema";
import { StorageService } from "../storage/storage.service";
import { UtilsService } from "../utils/utils.service";
const PRINTER_TIMEOUT = 15000; // 15 seconds
const PRINTER_TIMEOUT = 10000; // 10 seconds
@Injectable()
export class PrinterService {
private readonly logger = new Logger(PrinterService.name);
private browserEndpoint: string;
private browserURL: string;
constructor(
private readonly configService: ConfigService<Config>,
@ -31,12 +31,12 @@ export class PrinterService {
const chromeUrl = this.configService.getOrThrow<string>("CHROME_URL");
const chromeToken = this.configService.getOrThrow<string>("CHROME_TOKEN");
this.browserEndpoint = `${chromeUrl}?token=${chromeToken}`;
this.browserURL = `${chromeUrl}?token=${chromeToken}`;
}
private getBrowser() {
try {
return connect({ browserWSEndpoint: this.browserEndpoint });
return connect({ browserWSEndpoint: this.browserURL });
} catch (error) {
throw new InternalServerErrorException(ErrorMessage.InvalidBrowserConnection, error.message);
}
@ -56,10 +56,10 @@ export class PrinterService {
const start = performance.now();
const url = await retry(() => withTimeout(this.generateResume(resume), PRINTER_TIMEOUT), {
retries: 3,
retries: 2,
randomize: true,
onRetry: (_, attempt) => {
this.logger.debug(`Retrying resume print job: Attempt #${attempt}`);
this.logger.debug(`Print Resume: retry attempt #${attempt}`);
},
});