Improve tracking failure handling (#1063) #1445
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1063
Add a 1s timeout to tracking http calls
Add an on-failure handler that disables tracking after the first failure
To test this, I added this to my
/etc/hosts
:127.0.0.1 fishtownanalytics.sinter-collect.com
Then I ran this from a root python prompt:
And ran
dbt run
with tracking enabled in my profile. Before this change, dbt hangs forever. After, it pauses for 1 second once and then disables tracking until the nextdbt
invocation.I chose this model over a thread-based one because it makes process teardown and cancellation a whole lot easier.
The only actual change to
http_get
in the overriddenTimeoutEmitter
is thetimeout=1.0
argument torequests.get
, the rest is just pep8 formatting.I experimented with various times but I found anything longer than a second felt pretty annoying.