Skip to content

Commit

Permalink
Change the manipulated status endpoint so that it just returns 'ok'
Browse files Browse the repository at this point in the history
[refs %ed348cc55dc4]
  • Loading branch information
jfahrer committed May 5, 2018
1 parent 6bde50c commit 1795f09
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions swarm/swarm-demo-frontend/app.rb
Expand Up @@ -5,13 +5,8 @@
set :bind, '0.0.0.0'
set :port, 8080

min_healthchecks = ENV['MIN_REQUESTS_TILL_DEATH'] || 10
max_healthchecks = ENV['MAX_REQUESTS_TILL_DEATH'] || 25

AppState = {}
AppState[:total_requests] = 0
AppState[:total_healthchecks] = 0
AppState[:healthchecks_till_death] = rand(max_healthchecks - max_healthchecks) + min_healthchecks

get '/' do
AppState[:total_requests] += 1
Expand All @@ -28,14 +23,7 @@
end

get '/status' do
AppState[:total_healthchecks] += 1
if AppState[:total_healthchecks] >= AppState[:healthchecks_till_death]
status 500
'failure'
else
status 200
'ok'
end
'ok'
end

class RequestManager
Expand Down
2 changes: 1 addition & 1 deletion swarm/swarm-demo-frontend/docker-compose.yml
Expand Up @@ -2,7 +2,7 @@ version: "3.4"

services:
frontend:
image: jfahrer/swarm-demo-frontend:v10
image: jfahrer/swarm-demo-frontend:v11
env_file:
- config/app.env
healthcheck:
Expand Down

0 comments on commit 1795f09

Please sign in to comment.