@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.
Files changed (73) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +4 -1
  3. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
  4. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +2 -2
  5. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  6. package/dist/buildSnapshotTree.js +1 -1
  7. package/dist/buildSnapshotTree.js.map +1 -1
  8. package/dist/documentStorageServiceProxy.js +1 -2
  9. package/dist/documentStorageServiceProxy.js.map +1 -1
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/insecureUrlResolver.js +2 -4
  15. package/dist/insecureUrlResolver.js.map +1 -1
  16. package/dist/network.js +4 -4
  17. package/dist/network.js.map +1 -1
  18. package/dist/networkUtils.js +3 -4
  19. package/dist/networkUtils.js.map +1 -1
  20. package/dist/packageVersion.d.ts +1 -1
  21. package/dist/packageVersion.js +1 -1
  22. package/dist/packageVersion.js.map +1 -1
  23. package/dist/parallelRequests.js +28 -11
  24. package/dist/parallelRequests.js.map +1 -1
  25. package/dist/prefetchDocumentStorageService.js +1 -1
  26. package/dist/prefetchDocumentStorageService.js.map +1 -1
  27. package/dist/runWithRetry.d.ts +8 -0
  28. package/dist/runWithRetry.d.ts.map +1 -1
  29. package/dist/runWithRetry.js +29 -6
  30. package/dist/runWithRetry.js.map +1 -1
  31. package/dist/summaryForCreateNew.d.ts +0 -9
  32. package/dist/summaryForCreateNew.d.ts.map +1 -1
  33. package/dist/summaryForCreateNew.js +4 -27
  34. package/dist/summaryForCreateNew.js.map +1 -1
  35. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js +4 -1
  36. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
  37. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +2 -2
  38. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  39. package/lib/buildSnapshotTree.js +2 -2
  40. package/lib/buildSnapshotTree.js.map +1 -1
  41. package/lib/documentStorageServiceProxy.js +1 -2
  42. package/lib/documentStorageServiceProxy.js.map +1 -1
  43. package/lib/index.d.ts +2 -2
  44. package/lib/index.d.ts.map +1 -1
  45. package/lib/index.js +2 -2
  46. package/lib/index.js.map +1 -1
  47. package/lib/insecureUrlResolver.js +2 -4
  48. package/lib/insecureUrlResolver.js.map +1 -1
  49. package/lib/network.js +4 -4
  50. package/lib/network.js.map +1 -1
  51. package/lib/networkUtils.js +3 -4
  52. package/lib/networkUtils.js.map +1 -1
  53. package/lib/packageVersion.d.ts +1 -1
  54. package/lib/packageVersion.js +1 -1
  55. package/lib/packageVersion.js.map +1 -1
  56. package/lib/parallelRequests.js +28 -11
  57. package/lib/parallelRequests.js.map +1 -1
  58. package/lib/prefetchDocumentStorageService.js +1 -1
  59. package/lib/prefetchDocumentStorageService.js.map +1 -1
  60. package/lib/runWithRetry.d.ts +8 -0
  61. package/lib/runWithRetry.d.ts.map +1 -1
  62. package/lib/runWithRetry.js +27 -5
  63. package/lib/runWithRetry.js.map +1 -1
  64. package/lib/summaryForCreateNew.d.ts +0 -9
  65. package/lib/summaryForCreateNew.d.ts.map +1 -1
  66. package/lib/summaryForCreateNew.js +3 -25
  67. package/lib/summaryForCreateNew.js.map +1 -1
  68. package/package.json +27 -11
  69. package/src/buildSnapshotTree.ts +2 -2
  70. package/src/index.ts +1 -2
  71. package/src/packageVersion.ts +1 -1
  72. package/src/runWithRetry.ts +28 -4
  73. package/src/summaryForCreateNew.ts +0 -31
@@ -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
- { driverVersion: pkgVersion, fetchCallName },
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
- // If the waitTime is not specified, then we start with retrying immediately to max of 8s.
111
- retryAfterMs = getRetryDelayFromError(err) ?? Math.min(retryAfterMs * 2, 8000);
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.