Skip to content
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

Don't emit ERROR until a keepalive poke fails #223

Merged
merged 3 commits into from
Oct 7, 2016

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Oct 6, 2016

This accomplishes the same as
https://github.com/matrix-org/matrix-js-sdk/pull/216/files, but
without the client waiting 110 seconds for a sync request to time
out. That is, don't display an error message a soon as a sync
request fails, since we should accept that sometimes long lived
HTTP connections will go away and that's fine.

Also:

  • Use request rather than deprecated requestWithPrefix
  • http-api: The empty string may be falsy, but it's a valid prefix
  • Update the tests to mock keepalive behaviour appropriately, and change one to assert it just keeps emiting ERROR events if it keeps failing, rather than specifically if subsequent sync requests fail.

This accomplishes the same as
https://github.com/matrix-org/matrix-js-sdk/pull/216/files, but
without the client waiting 110 seconds for a sync request to time
out. That is, don't display an error message a soon as a sync
request fails, since we should accept that sometimes long lived
HTTP connections will go away and that's fine.

Also:
 * Use request rather than deprecated requestWithPrefix
 * http-api: The empty string may be falsy, but it's a valid prefix
 * Go back to previous behaviour of continuing to emit ERROR states if it continues to fail
 * Don't set a timer if the timeout is zero
 * Change test to assert the continued-error behaviour, not exactly multiple syncs failing
 * Update other tests to fail the keepalive requests where appropriate
// fails, since long lived HTTP connections will
// go away sometimes and we shouldn't treat this as
// erroneous.
// We sent the first keep alive immediately because
Copy link
Member

Choose a reason for hiding this comment

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

sent -> send

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

LGTM.

One thought: could we do away with the argument to _startKeepAlives and always start immediately?

@richvdh richvdh assigned dbkr and unassigned richvdh Oct 7, 2016
Changed my mind - it's a good idea to wait a short time before
sending a keepalive request: this will make sure we never
tightloop.

This also adds a 'RECONNECTING' state for when a sync request has
failed but there is no reason to suspect there is actually a
connectivity problem. This is necessary for the tests to be able
to advance the clock at the appropriate time, but could be nice
for clients. Add a breaking change changelog entry since
technically this is an API change that might break clients if they
were relying on 'SYNCING' always coming before 'ERROR' for some
reason.
@dbkr dbkr assigned richvdh and unassigned dbkr Oct 7, 2016
@richvdh richvdh merged commit 74d6cb8 into develop Oct 7, 2016
@dbkr dbkr deleted the dbkr/sync_dont_error_until_keepalive_fail branch December 14, 2016 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants