Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/sinatra/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PATH
featurehub-sdk (2.1.1)
concurrent-ruby (~> 1.3)
faraday
ld-eventsource (~> 2.5.1)
ld-eventsource (>= 2.5.1, < 2.7.0)
murmurhash3 (~> 0.1.7)
sem_version (~> 2.0.0)

Expand Down Expand Up @@ -44,6 +44,7 @@ GEM
faraday-rack (1.0.0)
faraday-retry (1.0.4)
ffi (1.17.3-x86_64-darwin)
ffi (1.17.3-x86_64-linux-gnu)
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
Expand Down
51 changes: 0 additions & 51 deletions examples/sinatra/sinatra.iml

This file was deleted.

87 changes: 0 additions & 87 deletions featurehub-sdk.iml

This file was deleted.

36 changes: 21 additions & 15 deletions lib/feature_hub/sdk/poll_edge_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,27 @@ def get_updates
headers["if-none-match"] = @etag unless @etag.nil?

@logger&.debug("polling for #{url}")
resp = @conn.get url, {}, headers
case resp.status
when 200
success(resp)
when 236
stopped_task
success(resp)
when 404, 400 # no such key
@repository.notify("failed", nil, "polling")
cancel_task
@logger&.error("featurehub: key does not exist, stopping polling")
when 503 # dacha busy
@logger&.debug("featurehub: dacha is busy, trying again")
else
@logger&.debug("featurehub: unknown error #{resp.status}") if resp.status != 304
begin
resp = @conn.get url, {}, headers
case resp.status
when 200
success(resp)
when 236
stopped_task
success(resp)
when 404, 400 # no such key
@repository.notify("failed", nil, "polling")
cancel_task
@logger&.error("featurehub: key does not exist, stopping polling")
when 503 # dacha busy
@logger&.debug("featurehub: dacha is busy, trying again")
else
@logger&.debug("featurehub: unknown error #{resp.status}") if resp.status != 304
end
rescue StandardError => e
# we can get timeout errors for transient network failures, this should not prevent the
# next poll from happening however
@logger&.error("featurehub: failed to connect or similar error #{e&.message}")
end
end

Expand Down
Loading