Skip to content

Add retry logic around logic IndexedDB connections. #4047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2020

Conversation

avolkovi
Copy link
Contributor

@avolkovi avolkovi commented Nov 6, 2020

@avolkovi avolkovi requested a review from sam-gc November 6, 2020 18:21
@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2020

⚠️ No Changeset found

Latest commit: 5968e21

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 6, 2020

Size Analysis Report

Affected Products

@firebase/auth-exp

  • getAuth

    Size

    Type Base (f9dc50e) Head (669fa16) Diff
    size 65.0 kB 65.2 kB +168 B (+0.3%)
    size_with_ext_deps 76.3 kB 76.5 kB +168 B (+0.2%)

    Dependencies

    Type Base (f9dc50e) Head (669fa16) Diff
    variables
    Click to show 41 depsAUTH_ERROR_FACTORY
    BASE_POPUP_OPTIONS
    DB_DATA_KEYPATH
    DB_NAME
    DB_OBJECTSTORE_NAME
    DB_VERSION
    DEFAULT_API_TIMEOUT_MS
    DEFAULT_HEIGHT
    DEFAULT_WIDTH
    EMULATED_IFRAME_PATH
    EMULATOR_WIDGET_PATH
    ERRORS
    EVENT_DUPLICATION_CACHE_DURATION_MS
    FIREFOX_EMPTY_URL
    HTTP_REGEX
    IDP_REQUEST_URI
    IE10_LOCAL_STORAGE_SYNC_DELAY
    IFRAME_ATTRIBUTES
    IFRAME_PATH
    IP_ADDRESS_REGEX
    NETWORK_TIMEOUT
    NETWORK_TIMEOUT_DELAY
    PING_TIMEOUT
    SERVER_ERROR_MAP
    STORAGE_AVAILABLE_KEY
    TARGET_BLANK
    WEB_STORAGE_SUPPORT_KEY
    WIDGET_PATH
    _POLLING_INTERVAL_MS
    _POLLING_INTERVAL_MS$1
    _POLL_WINDOW_CLOSE_TIMEOUT
    browserLocalPersistence
    browserPopupRedirectResolver
    browserSessionPersistence
    cachedGApiLoader
    inMemoryPersistence
    indexedDBLocalPersistence
    instanceCache
    logClient
    redirectOutcomeMap
    version
    Click to show 42 depsAUTH_ERROR_FACTORY
    BASE_POPUP_OPTIONS
    DB_DATA_KEYPATH
    DB_NAME
    DB_OBJECTSTORE_NAME
    DB_VERSION
    DEFAULT_API_TIMEOUT_MS
    DEFAULT_HEIGHT
    DEFAULT_WIDTH
    EMULATED_IFRAME_PATH
    EMULATOR_WIDGET_PATH
    ERRORS
    EVENT_DUPLICATION_CACHE_DURATION_MS
    FIREFOX_EMPTY_URL
    HTTP_REGEX
    IDP_REQUEST_URI
    IE10_LOCAL_STORAGE_SYNC_DELAY
    IFRAME_ATTRIBUTES
    IFRAME_PATH
    IP_ADDRESS_REGEX
    NETWORK_TIMEOUT
    NETWORK_TIMEOUT_DELAY
    PING_TIMEOUT
    SERVER_ERROR_MAP
    STORAGE_AVAILABLE_KEY
    TARGET_BLANK
    WEB_STORAGE_SUPPORT_KEY
    WIDGET_PATH
    _POLLING_INTERVAL_MS
    _POLLING_INTERVAL_MS$1
    _POLL_WINDOW_CLOSE_TIMEOUT
    _TRANSACTION_RETRY_COUNT
    browserLocalPersistence
    browserPopupRedirectResolver
    browserSessionPersistence
    cachedGApiLoader
    inMemoryPersistence
    indexedDBLocalPersistence
    instanceCache
    logClient
    redirectOutcomeMap
    version
    + _TRANSACTION_RETRY_COUNT
  • indexedDBLocalPersistence

    Size

    Type Base (f9dc50e) Head (669fa16) Diff
    size 45.1 kB 45.3 kB +168 B (+0.4%)
    size_with_ext_deps 55.6 kB 55.8 kB +168 B (+0.3%)

    Dependencies

    Type Base (f9dc50e) Head (669fa16) Diff
    variables
    Click to show 19 depsAUTH_ERROR_FACTORY
    DB_DATA_KEYPATH
    DB_NAME
    DB_OBJECTSTORE_NAME
    DB_VERSION
    DEFAULT_API_TIMEOUT_MS
    ERRORS
    NETWORK_TIMEOUT
    NETWORK_TIMEOUT_DELAY
    PING_TIMEOUT
    SERVER_ERROR_MAP
    STORAGE_AVAILABLE_KEY
    _POLLING_INTERVAL_MS$1
    _POLL_WINDOW_CLOSE_TIMEOUT
    inMemoryPersistence
    indexedDBLocalPersistence
    instanceCache
    logClient
    version
    Click to show 20 depsAUTH_ERROR_FACTORY
    DB_DATA_KEYPATH
    DB_NAME
    DB_OBJECTSTORE_NAME
    DB_VERSION
    DEFAULT_API_TIMEOUT_MS
    ERRORS
    NETWORK_TIMEOUT
    NETWORK_TIMEOUT_DELAY
    PING_TIMEOUT
    SERVER_ERROR_MAP
    STORAGE_AVAILABLE_KEY
    _POLLING_INTERVAL_MS$1
    _POLL_WINDOW_CLOSE_TIMEOUT
    _TRANSACTION_RETRY_COUNT
    inMemoryPersistence
    indexedDBLocalPersistence
    instanceCache
    logClient
    version
    + _TRANSACTION_RETRY_COUNT

Test Logs

this.db.close();
this.db = undefined;
}
// TODO: consider adding exponential backoff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding any sort of delay here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question for @schmidt-sebastian I think he mentioned they had this in Firestore but I couldn't find proof

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We retry immediately at this scope, but at the higher level we retry with backoff: https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/src/util/async_queue.ts#L361

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will consider adding that in a followup if this doesn't fix it

@avolkovi avolkovi merged commit 2d325e7 into master Nov 6, 2020
@avolkovi avolkovi deleted the avolkovi/indexeddb-retry-ts branch November 6, 2020 22:38
@firebase firebase locked and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants