@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.
@@ -523,17 +523,13 @@ class RESTTransport extends AbstractDataConnectTransport {
523
523
  /** The Request ID of the first request over the stream */
524
524
  const FIRST_REQUEST_ID = 1;
525
525
  /** Time to wait before closing an idle connection (no active subscriptions). */
526
- const IDLE_CONNECTION_TIMEOUT_MS = 0; // immediate close
526
+ const IDLE_CONNECTION_TIMEOUT_MS = 15 * 1000; // 15 seconds
527
527
  /** Initial reconnect delay in ms */
528
- const INITIAL_RECONNECT_DELAY_MS = 1000;
528
+ const INITIAL_RECONNECT_DELAY_MS = 1000; // 1 second
529
529
  /** Max reconnect delay in ms */
530
- const MAX_RECONNECT_DELAY_MS = 30000;
531
- /** Max random jitter to add to reconnect delay in ms */
532
- const MAX_RECONNECT_JITTER_MS = 500;
530
+ const MAX_RECONNECT_DELAY_MS = 60 * 1000; // 60 seconds
533
531
  /** Factor to multiply delay by on failure */
534
- const RECONNECT_BACKOFF_FACTOR = 1.3;
535
- /** Max number of reconnection attempts before giving up */
536
- const MAX_RECONNECT_ATTEMPTS = 10;
532
+ const RECONNECT_BACKOFF_FACTOR = 1.5;
537
533
  /**
538
534
  * The base class for all Stream Transport implementations.
539
535
  * Handles management of logical streams (requests), authentication, data routing to query layer,
@@ -785,15 +781,10 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
785
781
  if (this.reconnectTimer) {
786
782
  return;
787
783
  }
788
- if (this.reconnectAttempts++ >= MAX_RECONNECT_ATTEMPTS) {
789
- const errorString = 'Stream disconnected and could not reconnect - max stream reconnection attempts reached.';
790
- logError(errorString);
791
- void this.cleanupAndTerminate(Code.OTHER, errorString);
792
- return;
793
- }
784
+ this.reconnectAttempts++;
794
785
  const delay = this.reconnectDelayMs;
795
786
  this.reconnectDelayMs = Math.min(this.reconnectDelayMs * RECONNECT_BACKOFF_FACTOR, MAX_RECONNECT_DELAY_MS);
796
- const jitter = Math.random() * MAX_RECONNECT_JITTER_MS;
787
+ const jitter = (Math.random() - 0.5) * delay;
797
788
  this.reconnectTimer = setTimeout(() => {
798
789
  this.reconnectTimer = null;
799
790
  void this.attemptReconnect();
@@ -1557,7 +1548,7 @@ class WebSocketTransport extends AbstractDataConnectStreamTransport {
1557
1548
  }
1558
1549
 
1559
1550
  const name = "@firebase/data-connect";
1560
- const version = "0.7.1";
1551
+ const version = "0.7.2-eap-crashlytics.e21972d2a";
1561
1552
 
1562
1553
  /**
1563
1554
  * @license
@@ -3149,6 +3140,7 @@ function makeMemoryCacheProvider() {
3149
3140
  * See the License for the specific language governing permissions and
3150
3141
  * limitations under the License.
3151
3142
  */
3143
+ // eslint-disable-next-line import/no-extraneous-dependencies
3152
3144
  function registerDataConnect(variant) {
3153
3145
  setSDKVersion(SDK_VERSION$1);
3154
3146
  _registerComponent(new Component('data-connect', (container, { instanceIdentifier: connectorConfigStr, options }) => {