@fluidframework/driver-utils 2.0.0-internal.5.3.2 → 2.0.0-internal.6.0.0
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/CHANGELOG.md +16 -0
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +4 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +2 -2
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/buildSnapshotTree.js +1 -1
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/documentStorageServiceProxy.js +1 -2
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/insecureUrlResolver.js +2 -4
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/network.js +4 -4
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.js +3 -4
- package/dist/networkUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/parallelRequests.js +28 -11
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.js +1 -1
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/runWithRetry.d.ts +8 -0
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/runWithRetry.js +29 -6
- package/dist/runWithRetry.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +0 -9
- package/dist/summaryForCreateNew.d.ts.map +1 -1
- package/dist/summaryForCreateNew.js +4 -27
- package/dist/summaryForCreateNew.js.map +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js +4 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +2 -2
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/buildSnapshotTree.js +2 -2
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/documentStorageServiceProxy.js +1 -2
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/insecureUrlResolver.js +2 -4
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/network.js +4 -4
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.js +3 -4
- package/lib/networkUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/parallelRequests.js +28 -11
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.js +1 -1
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/runWithRetry.d.ts +8 -0
- package/lib/runWithRetry.d.ts.map +1 -1
- package/lib/runWithRetry.js +27 -5
- package/lib/runWithRetry.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +0 -9
- package/lib/summaryForCreateNew.d.ts.map +1 -1
- package/lib/summaryForCreateNew.js +3 -25
- package/lib/summaryForCreateNew.js.map +1 -1
- package/package.json +27 -11
- package/src/buildSnapshotTree.ts +2 -2
- package/src/index.ts +1 -2
- package/src/packageVersion.ts +1 -1
- package/src/runWithRetry.ts +28 -4
- package/src/summaryForCreateNew.ts +0 -31
package/src/runWithRetry.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
|
+
import { ITelemetryLoggerExt, isFluidError } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { delay, performance } from "@fluidframework/common-utils";
|
|
8
8
|
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
9
9
|
import { canRetryOnError, getRetryDelayFromError } from "./network";
|
|
@@ -80,13 +80,20 @@ export async function runWithRetry<T>(
|
|
|
80
80
|
retry: numRetries,
|
|
81
81
|
duration: performance.now() - startTime,
|
|
82
82
|
fetchCallName,
|
|
83
|
+
// TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
|
|
84
|
+
reason: (progress.cancel as AbortSignal & { reason: any }).reason,
|
|
83
85
|
},
|
|
84
86
|
err,
|
|
85
87
|
);
|
|
86
88
|
throw new NonRetryableError(
|
|
87
89
|
"runWithRetry was Aborted",
|
|
88
90
|
DriverErrorType.genericError,
|
|
89
|
-
{
|
|
91
|
+
{
|
|
92
|
+
driverVersion: pkgVersion,
|
|
93
|
+
fetchCallName,
|
|
94
|
+
// TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
|
|
95
|
+
reason: (progress.cancel as AbortSignal & { reason: any }).reason,
|
|
96
|
+
},
|
|
90
97
|
);
|
|
91
98
|
}
|
|
92
99
|
|
|
@@ -107,8 +114,9 @@ export async function runWithRetry<T>(
|
|
|
107
114
|
numRetries++;
|
|
108
115
|
lastError = err;
|
|
109
116
|
// If the error is throttling error, then wait for the specified time before retrying.
|
|
110
|
-
|
|
111
|
-
|
|
117
|
+
retryAfterMs =
|
|
118
|
+
getRetryDelayFromError(err) ??
|
|
119
|
+
Math.min(retryAfterMs * 2, calculateMaxWaitTime(err));
|
|
112
120
|
if (progress.onRetry) {
|
|
113
121
|
progress.onRetry(retryAfterMs, err);
|
|
114
122
|
}
|
|
@@ -129,3 +137,19 @@ export async function runWithRetry<T>(
|
|
|
129
137
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
130
138
|
return result!;
|
|
131
139
|
}
|
|
140
|
+
|
|
141
|
+
const MaxReconnectDelayInMsWhenEndpointIsReachable = 30000;
|
|
142
|
+
const MaxReconnectDelayInMsWhenEndpointIsNotReachable = 8000;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* In case endpoint(service or socket) is not reachable, then we maybe offline or may have got some transient error
|
|
146
|
+
* not related to endpoint, in that case we want to try at faster pace and hence the max wait is lesser 8s as compared
|
|
147
|
+
* to when endpoint is reachable in which case it is 30s.
|
|
148
|
+
* @param error - error based on which we decide max wait time.
|
|
149
|
+
* @returns - Max wait time.
|
|
150
|
+
*/
|
|
151
|
+
export function calculateMaxWaitTime(error: unknown): number {
|
|
152
|
+
return isFluidError(error) && error.getTelemetryProperties().endpointReached === true
|
|
153
|
+
? MaxReconnectDelayInMsWhenEndpointIsReachable
|
|
154
|
+
: MaxReconnectDelayInMsWhenEndpointIsNotReachable;
|
|
155
|
+
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert } from "@fluidframework/common-utils";
|
|
7
6
|
import {
|
|
8
7
|
ISummaryTree,
|
|
9
8
|
SummaryType,
|
|
@@ -46,36 +45,6 @@ export function isCombinedAppAndProtocolSummary(
|
|
|
46
45
|
return true;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
/**
|
|
50
|
-
* Combine the app summary and protocol summary in 1 tree.
|
|
51
|
-
* @param appSummary - Summary of the app.
|
|
52
|
-
* @param protocolSummary - Summary of the protocol.
|
|
53
|
-
* @internal
|
|
54
|
-
*
|
|
55
|
-
* @deprecated 2.0.0-internal.3.4.0 - Not intended for public use. Will be moved to container-loader and no longer exported in an upcoming release.
|
|
56
|
-
*/
|
|
57
|
-
export function combineAppAndProtocolSummary(
|
|
58
|
-
appSummary: ISummaryTree,
|
|
59
|
-
protocolSummary: ISummaryTree,
|
|
60
|
-
): CombinedAppAndProtocolSummary {
|
|
61
|
-
assert(
|
|
62
|
-
!isCombinedAppAndProtocolSummary(appSummary),
|
|
63
|
-
0x5a8 /* app summary is already a combined tree! */,
|
|
64
|
-
);
|
|
65
|
-
assert(
|
|
66
|
-
!isCombinedAppAndProtocolSummary(protocolSummary),
|
|
67
|
-
0x5a9 /* protocol summary is already a combined tree! */,
|
|
68
|
-
);
|
|
69
|
-
const createNewSummary: CombinedAppAndProtocolSummary = {
|
|
70
|
-
type: SummaryType.Tree,
|
|
71
|
-
tree: {
|
|
72
|
-
".protocol": protocolSummary,
|
|
73
|
-
".app": appSummary,
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
return createNewSummary;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
48
|
/**
|
|
80
49
|
* Extract the attributes from the protocol summary.
|
|
81
50
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|