got 替换为 uudici

This commit is contained in:
whyour
2025-05-15 01:01:39 +08:00
parent 3fafe4d24d
commit c3072e7712
8 changed files with 425 additions and 385 deletions
+8 -4
View File
@@ -1,7 +1,7 @@
import { spawn } from 'cross-spawn';
import { Response } from 'express';
import fs from 'fs';
import got from 'got';
import { Agent, request } from 'Undici';
import sum from 'lodash/sum';
import path from 'path';
import { Inject, Service } from 'typedi';
@@ -276,13 +276,17 @@ export default class SystemService {
let lastVersionContent;
try {
const result = await got.get(
const { body } = await request(
`${config.lastVersionFile}?t=${Date.now()}`,
{
timeout: 30000,
dispatcher: new Agent({
keepAliveTimeout: 30000,
keepAliveMaxTimeout: 30000,
}),
},
);
lastVersionContent = parseContentVersion(result.body);
const text = await body.text();
lastVersionContent = parseContentVersion(text);
} catch (error) {}
if (!lastVersionContent) {