This commit is contained in:
parent
3cfb2a2f80
commit
22ad0eec1d
@ -10,5 +10,7 @@ module.exports = {
|
|||||||
workers: 3, // async concurrent workers to scan
|
workers: 3, // async concurrent workers to scan
|
||||||
schedule: '5,11,17,23', // UTC hours to publish bot followers federated stats
|
schedule: '5,11,17,23', // UTC hours to publish bot followers federated stats
|
||||||
filterdomains: ['activitypub-troll.cf'], // domains filtered to scan
|
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
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
|
|||||||
module.exports = async (client, apex, app) => {
|
module.exports = async (client, apex, app) => {
|
||||||
const util = require('./util')(apex),
|
const util = require('./util')(apex),
|
||||||
constant = require('./constant'),
|
constant = require('./constant'),
|
||||||
https = require('https'),
|
|
||||||
schedule = require('node-schedule'),
|
schedule = require('node-schedule'),
|
||||||
workers = constant.workers,
|
workers = constant.workers,
|
||||||
getAccount = api => {
|
getAccount = api => {
|
||||||
@ -22,15 +21,12 @@ module.exports = async (client, apex, app) => {
|
|||||||
const ac = new AbortController()
|
const ac = new AbortController()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
ac.abort()
|
ac.abort()
|
||||||
}, 5000)
|
}, constant.abort_timeout)
|
||||||
const response = await fetch(uri, {
|
const response = await fetch(uri, {
|
||||||
headers: { 'User-Agent': constant.agent },
|
headers: { 'User-Agent': constant.agent },
|
||||||
agent: new https.Agent({
|
|
||||||
keepAlive: false
|
|
||||||
}),
|
|
||||||
signal: ac.signal,
|
signal: ac.signal,
|
||||||
keepalive: false,
|
keepalive: false,
|
||||||
timeout: 3000
|
timeout: constant.timeout
|
||||||
}),
|
}),
|
||||||
json = await response.json()
|
json = await response.json()
|
||||||
// setImmediate(() => { ac.abort() })
|
// setImmediate(() => { ac.abort() })
|
||||||
|
Loading…
Reference in New Issue
Block a user