Fix plugin RSS: agent: false pour fermer les connexions HTTP
This commit is contained in:
parent
f2f6e03777
commit
e88d6c2c13
1 changed files with 1 additions and 8 deletions
|
|
@ -2,8 +2,6 @@ const Parser = require('rss-parser');
|
||||||
const { XMLParser } = require('fast-xml-parser');
|
const { XMLParser } = require('fast-xml-parser');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const https = require('https');
|
|
||||||
const http = require('http');
|
|
||||||
|
|
||||||
const PER_REQUEST_TIMEOUT_MS = 20_000;
|
const PER_REQUEST_TIMEOUT_MS = 20_000;
|
||||||
const GLOBAL_TIMEOUT_MS = 600_000;
|
const GLOBAL_TIMEOUT_MS = 600_000;
|
||||||
|
|
@ -22,13 +20,10 @@ module.exports = function (context, options) {
|
||||||
async loadContent() {
|
async loadContent() {
|
||||||
console.log('[RSS Aggregator] Récupération des flux RSS...');
|
console.log('[RSS Aggregator] Récupération des flux RSS...');
|
||||||
|
|
||||||
const httpAgent = new http.Agent({ keepAlive: false });
|
|
||||||
const httpsAgent = new https.Agent({ keepAlive: false });
|
|
||||||
|
|
||||||
const parser = new Parser({
|
const parser = new Parser({
|
||||||
timeout: PER_REQUEST_TIMEOUT_MS,
|
timeout: PER_REQUEST_TIMEOUT_MS,
|
||||||
requestOptions: {
|
requestOptions: {
|
||||||
agent: { http: httpAgent, https: httpsAgent }
|
agent: false
|
||||||
},
|
},
|
||||||
customFields: {
|
customFields: {
|
||||||
item: ['description', 'content:encoded']
|
item: ['description', 'content:encoded']
|
||||||
|
|
@ -107,8 +102,6 @@ module.exports = function (context, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
clearTimeout(globalTimeoutId);
|
clearTimeout(globalTimeoutId);
|
||||||
httpAgent.destroy();
|
|
||||||
httpsAgent.destroy();
|
|
||||||
|
|
||||||
const groupedByCategory = new Map();
|
const groupedByCategory = new Map();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue