Skip to content

Reconnect when no data is received for 5 minutes.#66

Merged
drichelson merged 4 commits into
masterfrom
dr/heartbeats
Jan 10, 2017
Merged

Reconnect when no data is received for 5 minutes.#66
drichelson merged 4 commits into
masterfrom
dr/heartbeats

Conversation

@drichelson

Copy link
Copy Markdown
Contributor

Reconnect when no data is received for 5 minutes.

Comment thread ldclient/sse_client.py

name = m.groupdict()['name']
value = m.groupdict()['value']
if name == '':

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this wasn't actually working.

Comment thread ldclient/sse_client.py
self.resp = requester.get(
self.url,
stream=True,
timeout=(self._connect_timeout, self._read_timeout),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Setting the read_timeout here means that the request will throw a timeout error if no data is received for 5 minutes.. thus implementing heartbeat detection.

Comment thread ldclient/streaming.py Outdated
store.delete(key, version)
else:
log.warning('Unhandled event in stream processor: ' + msg.event)
elif msg.event != 'comment':

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

change this back

Comment thread ldclient/sse_client.py Outdated
and return a Event object.
"""
msg = cls()
if raw.startswith(':'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove this-- not necessary.

@jkodumal

Copy link
Copy Markdown
Contributor

👍

@drichelson drichelson merged commit 6e51add into master Jan 10, 2017
@drichelson drichelson deleted the dr/heartbeats branch January 10, 2017 03:09
eli-darkly added a commit that referenced this pull request Aug 3, 2018
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.

3 participants