@tmlmobilidade/utils 20260618.421.40 → 20260618.457.26
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { Timer } from '@tmlmobilidade/timer';
|
|
3
|
-
import { performInChunks } from './perform-in-chunks.js';
|
|
4
3
|
/**
|
|
5
4
|
* Copy documents from a source database to a destination database in multiple steps.
|
|
6
5
|
* The goal of this function is to ensure that the destination database has the same documents
|
|
@@ -67,9 +66,7 @@ export async function replicate({ countDestinationDbFn, countSourceDbFn, deleteD
|
|
|
67
66
|
// as they are not present in the source database.
|
|
68
67
|
const deleteStepTimer = new Timer();
|
|
69
68
|
if (extraDocumentIds.length > 0 && deleteDestinationDbFn) {
|
|
70
|
-
await
|
|
71
|
-
await deleteDestinationDbFn(chunk);
|
|
72
|
-
}, 1_000);
|
|
69
|
+
await deleteDestinationDbFn(extraDocumentIds);
|
|
73
70
|
console.info(`Deleted ${extraDocumentIds.length} extra documents in the Destination database. (${deleteStepTimer.get()})`);
|
|
74
71
|
}
|
|
75
72
|
//
|