genbox 1.0.81 → 1.0.82
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/dist/db-utils.js +10 -1
- package/package.json +1 -1
package/dist/db-utils.js
CHANGED
|
@@ -117,11 +117,20 @@ function getMongoDumpInstallInstructions() {
|
|
|
117
117
|
async function runLocalMongoDump(sourceUrl, options = {}) {
|
|
118
118
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'genbox-dbdump-'));
|
|
119
119
|
const dumpPath = path.join(tempDir, 'dump.gz');
|
|
120
|
+
// Add timeout parameters to URI if not already present
|
|
121
|
+
// This prevents connection drops on large databases
|
|
122
|
+
let uriWithTimeout = sourceUrl;
|
|
123
|
+
const hasTimeout = sourceUrl.includes('socketTimeoutMS') || sourceUrl.includes('connectTimeoutMS');
|
|
124
|
+
if (!hasTimeout) {
|
|
125
|
+
const separator = sourceUrl.includes('?') ? '&' : '?';
|
|
126
|
+
uriWithTimeout = `${sourceUrl}${separator}socketTimeoutMS=300000&connectTimeoutMS=60000`;
|
|
127
|
+
}
|
|
120
128
|
return new Promise((resolve) => {
|
|
121
129
|
const args = [
|
|
122
|
-
`--uri=${
|
|
130
|
+
`--uri=${uriWithTimeout}`,
|
|
123
131
|
`--archive=${dumpPath}`,
|
|
124
132
|
'--gzip',
|
|
133
|
+
'--numParallelCollections=1', // Dump one collection at a time - more reliable for large DBs
|
|
125
134
|
];
|
|
126
135
|
// Add collection filters
|
|
127
136
|
if (options.collections && options.collections.length > 0) {
|