@opentermsarchive/engine 9.2.0 → 9.2.2
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AbortController from 'abort-controller';
|
|
2
2
|
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';
|
|
5
5
|
import nodeFetch, { AbortError } from 'node-fetch';
|
|
6
6
|
|
|
7
7
|
import { resolveProxyConfiguration } from './proxyUtils.js';
|
|
@@ -12,8 +12,11 @@ export default class Recorder {
|
|
|
12
12
|
return Promise.all([ this.versionsRepository.initialize(), this.snapshotsRepository.initialize() ]);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
finalize() {
|
|
16
|
-
|
|
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();
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
getLatestSnapshot(terms, sourceDocumentId) {
|
|
@@ -135,7 +135,7 @@ export default class MongoRepository extends RepositoryInterface {
|
|
|
135
135
|
|
|
136
136
|
async #toPersistence(record) {
|
|
137
137
|
if (record.content === undefined || record.content === null) {
|
|
138
|
-
await this.
|
|
138
|
+
await this.loadRecordContent(record);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
return DataMapper.toPersistence(record);
|