smart-image-scraper-mcp 2.12.2 → 2.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -169,10 +169,11 @@ export class FileManager {
|
|
|
169
169
|
|
|
170
170
|
response = await httpClient.get(url, {
|
|
171
171
|
responseType: 'stream',
|
|
172
|
-
timeout:
|
|
172
|
+
timeout: 10000, // 连接超时10秒
|
|
173
173
|
maxContentLength: 50 * 1024 * 1024, // 最大50MB
|
|
174
174
|
maxBodyLength: 50 * 1024 * 1024,
|
|
175
175
|
headers: downloadHeaders,
|
|
176
|
+
signal: AbortSignal.timeout(12000), // 12秒硬超时,防止连接挂起
|
|
176
177
|
});
|
|
177
178
|
|
|
178
179
|
if (response.status !== 200) {
|
|
@@ -214,7 +215,7 @@ export class FileManager {
|
|
|
214
215
|
let downloadedBytes = 0;
|
|
215
216
|
const maxBytes = 50 * 1024 * 1024;
|
|
216
217
|
|
|
217
|
-
// 下载超时保护(
|
|
218
|
+
// 下载超时保护(15秒)
|
|
218
219
|
downloadTimeout = setTimeout(() => {
|
|
219
220
|
if (!resolved) {
|
|
220
221
|
resolved = true;
|
|
@@ -223,7 +224,7 @@ export class FileManager {
|
|
|
223
224
|
this._cleanupFile(filePath);
|
|
224
225
|
resolve({ success: false, url, error: 'Download timeout' });
|
|
225
226
|
}
|
|
226
|
-
},
|
|
227
|
+
}, 15000);
|
|
227
228
|
|
|
228
229
|
response.data.on('data', (chunk) => {
|
|
229
230
|
downloadedBytes += chunk.length;
|