Skip to content

Instantly share code, notes, and snippets.

@IanVaughan
Created October 17, 2024 10:16
Show Gist options
  • Save IanVaughan/f7d377b9d8b42b493af2e322c4b4f073 to your computer and use it in GitHub Desktop.
Save IanVaughan/f7d377b9d8b42b493af2e322c4b4f073 to your computer and use it in GitHub Desktop.
Simple sinatra app that sleeps for even internal_ids
require 'sinatra'
require 'net/http'
require 'uri'
require 'json'
get '/frank-says' do
'Put this in your pipe & smoke it!'
end
post '/submit' do
data = JSON.parse(request.body.read)
if (data['internal_id'] % 2 == 0)
puts "Sleeping long #{data['internal_id']}"
sleep(20)
else
puts "Sleeping quick #{data['internal_id']}"
sleep(1)
end
puts "Returning for #{data['internal_id']}"
"Received POST request with data: #{data}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment