retold-data-service 2.0.37 → 2.0.38
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
|
@@ -1018,12 +1018,19 @@ class RetoldDataServiceDataCloner extends libFableServiceProviderBase
|
|
|
1018
1018
|
let tmpTracker = tmpSyncEntity.operation.progressTrackers[`FullSync-${tmpTableName}`];
|
|
1019
1019
|
if (tmpTracker)
|
|
1020
1020
|
{
|
|
1021
|
-
|
|
1021
|
+
// Clamp both to >= 0: Total can be estimated from
|
|
1022
|
+
// Server.RecordCount - Local.RecordCount, which is
|
|
1023
|
+
// negative when local has extra records (e.g. after
|
|
1024
|
+
// server-side deletes). A negative total in the
|
|
1025
|
+
// progress report is nonsensical.
|
|
1026
|
+
tmpProgress.Total = Math.max(tmpTracker.TotalCount || 0, 0);
|
|
1022
1027
|
tmpProgress.Synced = Math.max(tmpTracker.CurrentCount || 0, 0);
|
|
1023
1028
|
}
|
|
1024
1029
|
}
|
|
1025
1030
|
|
|
1026
1031
|
// Read per-record breakdown from the sync entity
|
|
1032
|
+
let tmpEntityErrors = 0;
|
|
1033
|
+
let tmpEntitySkipped = 0;
|
|
1027
1034
|
if (tmpSyncEntity && tmpSyncEntity.syncResults)
|
|
1028
1035
|
{
|
|
1029
1036
|
let tmpResults = tmpSyncEntity.syncResults;
|
|
@@ -1033,12 +1040,12 @@ class RetoldDataServiceDataCloner extends libFableServiceProviderBase
|
|
|
1033
1040
|
tmpProgress.Deleted = tmpResults.Deleted || 0;
|
|
1034
1041
|
tmpProgress.ServerTotal = tmpResults.ServerRecordCount || 0;
|
|
1035
1042
|
tmpProgress.LocalCountBefore = tmpResults.LocalRecordCount || 0;
|
|
1043
|
+
tmpEntityErrors = tmpResults.Errors || 0;
|
|
1044
|
+
tmpEntitySkipped = tmpResults.Skipped || 0;
|
|
1036
1045
|
}
|
|
1037
1046
|
|
|
1038
1047
|
let tmpRESTErrors = this._cloneState.SyncRESTErrors[tmpTableName] || 0;
|
|
1039
|
-
tmpProgress.Errors = tmpRESTErrors;
|
|
1040
|
-
|
|
1041
|
-
let tmpMissing = tmpProgress.Total - tmpProgress.Synced;
|
|
1048
|
+
tmpProgress.Errors = tmpRESTErrors + tmpEntityErrors;
|
|
1042
1049
|
|
|
1043
1050
|
if (pError)
|
|
1044
1051
|
{
|
|
@@ -1048,25 +1055,35 @@ class RetoldDataServiceDataCloner extends libFableServiceProviderBase
|
|
|
1048
1055
|
this.logSyncEvent('TableError', `Sync [${tmpTableName}] — error: ${pError}`,
|
|
1049
1056
|
{ Table: tmpTableName, Total: tmpProgress.Total, Synced: tmpProgress.Synced, Error: `${pError}` });
|
|
1050
1057
|
}
|
|
1051
|
-
else if (tmpRESTErrors > 0)
|
|
1052
|
-
{
|
|
1053
|
-
tmpProgress.Status = 'Error';
|
|
1054
|
-
tmpProgress.ErrorMessage = `${tmpRESTErrors} REST error(s) during sync`;
|
|
1055
|
-
this.fable.log.warn(`Data Cloner: Sync [${tmpTableName}] — completed with ${tmpRESTErrors} REST error(s). ${tmpProgress.Synced}/${tmpProgress.Total} records synced.`);
|
|
1056
|
-
this.logSyncEvent('TableError', `Sync [${tmpTableName}] — ${tmpRESTErrors} REST error(s).`,
|
|
1057
|
-
{ Table: tmpTableName, Total: tmpProgress.Total, Synced: tmpProgress.Synced, RESTErrors: tmpRESTErrors });
|
|
1058
|
-
}
|
|
1059
|
-
else if (tmpProgress.Total > 0 && tmpMissing > 0)
|
|
1058
|
+
else if (tmpRESTErrors > 0 || tmpEntityErrors > 0)
|
|
1060
1059
|
{
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1060
|
+
// Only treat the sync as Partial/Error when the sync
|
|
1061
|
+
// entity actually reported errors (REST fetch errors or
|
|
1062
|
+
// per-record commit errors). A count-mismatch between
|
|
1063
|
+
// estimated Total and actual Synced is not itself an
|
|
1064
|
+
// error — pre-count estimates can be stale (records
|
|
1065
|
+
// were updated rather than added, local already has
|
|
1066
|
+
// records past the server's max ID, etc.), and the
|
|
1067
|
+
// sync code correctly downloads nothing in those
|
|
1068
|
+
// cases. Reporting "N skipped" for pure estimate
|
|
1069
|
+
// drift is noisy and misleading.
|
|
1070
|
+
let tmpPartialMessage = (tmpRESTErrors > 0 && tmpEntityErrors > 0)
|
|
1071
|
+
? `${tmpRESTErrors} REST error(s) and ${tmpEntityErrors} record error(s) during sync`
|
|
1072
|
+
: (tmpRESTErrors > 0)
|
|
1073
|
+
? `${tmpRESTErrors} REST error(s) during sync`
|
|
1074
|
+
: `${tmpEntityErrors} record error(s) during sync`;
|
|
1075
|
+
tmpProgress.Status = (tmpRESTErrors > 0) ? 'Error' : 'Partial';
|
|
1076
|
+
tmpProgress.ErrorMessage = tmpPartialMessage;
|
|
1077
|
+
tmpProgress.Skipped = tmpEntitySkipped;
|
|
1078
|
+
this.fable.log.warn(`Data Cloner: Sync [${tmpTableName}] — ${tmpPartialMessage}. ${tmpProgress.Synced}/${tmpProgress.Total} records synced.`);
|
|
1079
|
+
this.logSyncEvent(tmpProgress.Status === 'Error' ? 'TableError' : 'TablePartial',
|
|
1080
|
+
`Sync [${tmpTableName}] — ${tmpPartialMessage}.`,
|
|
1081
|
+
{ Table: tmpTableName, Total: tmpProgress.Total, Synced: tmpProgress.Synced, RESTErrors: tmpRESTErrors, RecordErrors: tmpEntityErrors });
|
|
1066
1082
|
}
|
|
1067
1083
|
else
|
|
1068
1084
|
{
|
|
1069
1085
|
tmpProgress.Status = 'Complete';
|
|
1086
|
+
tmpProgress.Skipped = tmpEntitySkipped;
|
|
1070
1087
|
this.fable.log.info(`Data Cloner: Sync [${tmpTableName}] — complete. ${tmpProgress.Synced}/${tmpProgress.Total} records synced.`);
|
|
1071
1088
|
this.logSyncEvent('TableComplete', `Sync [${tmpTableName}] — complete. ${tmpProgress.Synced}/${tmpProgress.Total} records.`,
|
|
1072
1089
|
{ Table: tmpTableName, Total: tmpProgress.Total, Synced: tmpProgress.Synced });
|