Skip to content

Commit 79f56bd

Browse files
authored
Fix http-proxy-agent / https-proxy-agent imports in htmlOnlyFetcher (#1206)
2 parents aec5133 + 18378f9 commit 79f56bd

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## Unreleased [patch]
6+
7+
> Development of this release was supported by the [European Commission](https://commission.europa.eu/) for its [VLOPs/VLOSEs instance](https://code.europa.eu/dsa/terms-and-conditions-database/vlops-and-vloses/).
8+
9+
### Fixed
10+
11+
- Fix tracking when proxy configuration is provided
12+
513
## 9.2.0 - 2025-11-05
614

715
_Full changeset and discussions: [#1173](https://github.com/OpenTermsArchive/engine/pull/1173)._

src/archivist/fetcher/htmlOnlyFetcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import AbortController from 'abort-controller';
22
import convertBody from 'fetch-charset-detection'; // eslint-disable-line import/no-unresolved
3-
import HttpProxyAgent from 'http-proxy-agent';
4-
import HttpsProxyAgent from 'https-proxy-agent';
3+
import { HttpProxyAgent } from 'http-proxy-agent';
4+
import { HttpsProxyAgent } from 'https-proxy-agent';
55
import nodeFetch, { AbortError } from 'node-fetch';
66

77
import { resolveProxyConfiguration } from './proxyUtils.js';

src/archivist/recorder/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ export default class Recorder {
1212
return Promise.all([ this.versionsRepository.initialize(), this.snapshotsRepository.initialize() ]);
1313
}
1414

15-
finalize() {
16-
return Promise.all([ this.versionsRepository.finalize(), this.snapshotsRepository.finalize() ]);
15+
async finalize() {
16+
// Close repositories sequentially to avoid race conditions when both repositories use the same MongoDB connection (same server/database).
17+
// Parallel closing can cause "Operation interrupted because client was closed" errors, especially on Windows.
18+
await this.versionsRepository.finalize();
19+
await this.snapshotsRepository.finalize();
1720
}
1821

1922
getLatestSnapshot(terms, sourceDocumentId) {

0 commit comments

Comments
 (0)