kavion commited on
Commit
60cf846
·
unverified ·
1 Parent(s): 46fb463

chore: set all timeouts to 25s

Browse files
Files changed (2) hide show
  1. app.js +1 -1
  2. turnstile-solver.js +5 -5
app.js CHANGED
@@ -10,7 +10,7 @@ app.use(express.json());
10
 
11
  // Singleton solver — browser tetap hidup selama server berjalan
12
  const solver = new TurnstileSolver({
13
- timeout: 90000,
14
  record: false,
15
  width: 1280,
16
  height: 720,
 
10
 
11
  // Singleton solver — browser tetap hidup selama server berjalan
12
  const solver = new TurnstileSolver({
13
+ timeout: 25000,
14
  record: false,
15
  width: 1280,
16
  height: 720,
turnstile-solver.js CHANGED
@@ -47,7 +47,7 @@ class TurnstileSolver {
47
  * @param {number} opts.height - viewport height (default 720)
48
  */
49
  constructor(opts = {}) {
50
- this.timeout = opts.timeout ?? 60000;
51
  this.record = opts.record ?? false;
52
  this.recordDir = opts.recordDir ?? path.join(process.cwd(), 'recordings');
53
  this.proxy = opts.proxy ?? null;
@@ -125,8 +125,8 @@ class TurnstileSolver {
125
  async _newPage() {
126
  const page = await this.browser.newPage();
127
 
128
- await page.setDefaultTimeout(30000);
129
- await page.setDefaultNavigationTimeout(30000);
130
 
131
  if (this.proxy?.username && this.proxy?.password) {
132
  await page.authenticate({
@@ -158,7 +158,7 @@ class TurnstileSolver {
158
  }
159
  });
160
 
161
- await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
162
  await page.waitForSelector('[name="cf-response"]', { timeout: this.timeout });
163
 
164
  const token = await page.evaluate(() =>
@@ -211,7 +211,7 @@ class TurnstileSolver {
211
  waitForToken();
212
  });
213
 
214
- await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
215
  await page.waitForSelector('[name="cf-response"]', { timeout: this.timeout });
216
 
217
  const token = await page.evaluate(() =>
 
47
  * @param {number} opts.height - viewport height (default 720)
48
  */
49
  constructor(opts = {}) {
50
+ this.timeout = opts.timeout ?? 25000;
51
  this.record = opts.record ?? false;
52
  this.recordDir = opts.recordDir ?? path.join(process.cwd(), 'recordings');
53
  this.proxy = opts.proxy ?? null;
 
125
  async _newPage() {
126
  const page = await this.browser.newPage();
127
 
128
+ await page.setDefaultTimeout(25000);
129
+ await page.setDefaultNavigationTimeout(25000);
130
 
131
  if (this.proxy?.username && this.proxy?.password) {
132
  await page.authenticate({
 
158
  }
159
  });
160
 
161
+ await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 25000 });
162
  await page.waitForSelector('[name="cf-response"]', { timeout: this.timeout });
163
 
164
  const token = await page.evaluate(() =>
 
211
  waitForToken();
212
  });
213
 
214
+ await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 25000 });
215
  await page.waitForSelector('[name="cf-response"]', { timeout: this.timeout });
216
 
217
  const token = await page.evaluate(() =>