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