meadow-integration 1.0.25 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meadow-integration",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "Meadow Data Integration",
5
5
  "bin": {
6
6
  "mdwint": "source/cli/Meadow-Integration-CLI-Run.js"
@@ -211,11 +211,21 @@ class MeadowSyncEntityComparisonOnly extends libMeadowSyncEntityOngoing
211
211
 
212
212
  this.fable.log.info(`${this.EntitySchema.TableName}: compare subdividing range ${pMinID}-${pMaxID} at ID ${tmpMidID} (depth ${pDepth})`);
213
213
 
214
- this._compareRange(pMinID, tmpMidID, pDepth + 1, pReport,
215
- () =>
216
- {
217
- this._compareRange(tmpMidID + 1, pMaxID, pDepth + 1, pReport, fCallback);
218
- });
214
+ // Use setImmediate to break the recursive call chain. With synchronous
215
+ // database providers (e.g. better-sqlite3), the entire bisection tree
216
+ // would otherwise execute in a single call stack, exhausting it for
217
+ // large ID ranges.
218
+ setImmediate(() =>
219
+ {
220
+ this._compareRange(pMinID, tmpMidID, pDepth + 1, pReport,
221
+ () =>
222
+ {
223
+ setImmediate(() =>
224
+ {
225
+ this._compareRange(tmpMidID + 1, pMaxID, pDepth + 1, pReport, fCallback);
226
+ });
227
+ });
228
+ });
219
229
  }
220
230
 
221
231
  _syncInternal(fCallback)
@@ -122,12 +122,20 @@ class MeadowSyncEntityOngoingEventualConsistency extends libMeadowSyncEntityOngo
122
122
  this.fable.log.info(`${this.EntitySchema.TableName}: subdividing range ${pMinID}-${pMaxID} at ID ${tmpMidID} (depth ${pDepth}, upper half first)`);
123
123
 
124
124
  // Upper half first (reversed from standard bisection)
125
- this._bisectRangeWithTimeBudget(tmpMidID + 1, pMaxID, pDepth + 1, pStartTime, pTimeLimit,
126
- () =>
127
- {
128
- // Then lower half (if time remains -- checked at entry of next call)
129
- this._bisectRangeWithTimeBudget(pMinID, tmpMidID, pDepth + 1, pStartTime, pTimeLimit, fCallback);
130
- });
125
+ // Use setImmediate to break the recursive call chain for synchronous
126
+ // database providers (e.g. better-sqlite3).
127
+ setImmediate(() =>
128
+ {
129
+ this._bisectRangeWithTimeBudget(tmpMidID + 1, pMaxID, pDepth + 1, pStartTime, pTimeLimit,
130
+ () =>
131
+ {
132
+ // Then lower half (if time remains -- checked at entry of next call)
133
+ setImmediate(() =>
134
+ {
135
+ this._bisectRangeWithTimeBudget(pMinID, tmpMidID, pDepth + 1, pStartTime, pTimeLimit, fCallback);
136
+ });
137
+ });
138
+ });
131
139
  }
132
140
 
133
141
  _syncInternal(fCallback)