constant timeouts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
ale 2024-09-24 01:18:05 +02:00
parent 3cfb2a2f80
commit 22ad0eec1d
2 changed files with 5 additions and 7 deletions

View File

@ -10,5 +10,7 @@ module.exports = {
workers: 3, // async concurrent workers to scan
schedule: '5,11,17,23', // UTC hours to publish bot followers federated stats
filterdomains: ['activitypub-troll.cf'], // domains filtered to scan
initialscan: 'mastodon.social' // initial federated domain to scan
initialscan: 'mastodon.social', // initial federated domain to scan
timeout: 3000, // Timeout of each scan request
abort_timeout: 4000 // Timeout of abort scan request
}

View File

@ -3,7 +3,6 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
module.exports = async (client, apex, app) => {
const util = require('./util')(apex),
constant = require('./constant'),
https = require('https'),
schedule = require('node-schedule'),
workers = constant.workers,
getAccount = api => {
@ -22,15 +21,12 @@ module.exports = async (client, apex, app) => {
const ac = new AbortController()
setTimeout(() => {
ac.abort()
}, 5000)
}, constant.abort_timeout)
const response = await fetch(uri, {
headers: { 'User-Agent': constant.agent },
agent: new https.Agent({
keepAlive: false
}),
signal: ac.signal,
keepalive: false,
timeout: 3000
timeout: constant.timeout
}),
json = await response.json()
// setImmediate(() => { ac.abort() })