@firebase/data-connect 0.7.1 → 0.7.2-eap-crashlytics.e21972d2a

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/index.cjs.js CHANGED
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
8
8
  var logger$1 = require('@firebase/logger');
9
9
 
10
10
  const name = "@firebase/data-connect";
11
- const version = "0.7.1";
11
+ const version = "0.7.2-eap-crashlytics.e21972d2a";
12
12
 
13
13
  /**
14
14
  * @license
@@ -1667,17 +1667,13 @@ class RESTTransport extends AbstractDataConnectTransport {
1667
1667
  /** The Request ID of the first request over the stream */
1668
1668
  const FIRST_REQUEST_ID = 1;
1669
1669
  /** Time to wait before closing an idle connection (no active subscriptions). */
1670
- const IDLE_CONNECTION_TIMEOUT_MS = 0; // immediate close
1670
+ const IDLE_CONNECTION_TIMEOUT_MS = 15 * 1000; // 15 seconds
1671
1671
  /** Initial reconnect delay in ms */
1672
- const INITIAL_RECONNECT_DELAY_MS = 1000;
1672
+ const INITIAL_RECONNECT_DELAY_MS = 1000; // 1 second
1673
1673
  /** Max reconnect delay in ms */
1674
- const MAX_RECONNECT_DELAY_MS = 30000;
1675
- /** Max random jitter to add to reconnect delay in ms */
1676
- const MAX_RECONNECT_JITTER_MS = 500;
1674
+ const MAX_RECONNECT_DELAY_MS = 60 * 1000; // 60 seconds
1677
1675
  /** Factor to multiply delay by on failure */
1678
- const RECONNECT_BACKOFF_FACTOR = 1.3;
1679
- /** Max number of reconnection attempts before giving up */
1680
- const MAX_RECONNECT_ATTEMPTS = 10;
1676
+ const RECONNECT_BACKOFF_FACTOR = 1.5;
1681
1677
  /**
1682
1678
  * The base class for all Stream Transport implementations.
1683
1679
  * Handles management of logical streams (requests), authentication, data routing to query layer,
@@ -1929,15 +1925,10 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
1929
1925
  if (this.reconnectTimer) {
1930
1926
  return;
1931
1927
  }
1932
- if (this.reconnectAttempts++ >= MAX_RECONNECT_ATTEMPTS) {
1933
- const errorString = 'Stream disconnected and could not reconnect - max stream reconnection attempts reached.';
1934
- logError(errorString);
1935
- void this.cleanupAndTerminate(Code.OTHER, errorString);
1936
- return;
1937
- }
1928
+ this.reconnectAttempts++;
1938
1929
  const delay = this.reconnectDelayMs;
1939
1930
  this.reconnectDelayMs = Math.min(this.reconnectDelayMs * RECONNECT_BACKOFF_FACTOR, MAX_RECONNECT_DELAY_MS);
1940
- const jitter = Math.random() * MAX_RECONNECT_JITTER_MS;
1931
+ const jitter = (Math.random() - 0.5) * delay;
1941
1932
  this.reconnectTimer = setTimeout(() => {
1942
1933
  this.reconnectTimer = null;
1943
1934
  void this.attemptReconnect();
@@ -3137,6 +3128,7 @@ function makeMemoryCacheProvider() {
3137
3128
  * See the License for the specific language governing permissions and
3138
3129
  * limitations under the License.
3139
3130
  */
3131
+ // eslint-disable-next-line import/no-extraneous-dependencies
3140
3132
  function registerDataConnect(variant) {
3141
3133
  setSDKVersion(app.SDK_VERSION);
3142
3134
  app._registerComponent(new component.Component('data-connect', (container, { instanceIdentifier: connectorConfigStr, options }) => {