Skip to content

Instantly share code, notes, and snippets.

@adorr
Created August 27, 2011 04:56
Show Gist options
  • Save adorr/1175001 to your computer and use it in GitHub Desktop.
Save adorr/1175001 to your computer and use it in GitHub Desktop.
ruby session concurrency problem
class FoosController < ApplicationController
def zero
session[:zero] = "zero"
sleep 1
render :text => "zero: #{session[:zero]}<br/>one: #{session[:one]}<br/>two: #{session[:two]}
<br/>three: #{session[:three]}"
end
def one
session[:one] = "one"
sleep 1
render :text => "zero: #{session[:zero]}<br/>one: #{session[:one]}<br/>two: #{session[:two]}
<br/>three: #{session[:three]}"
end
def two
session[:two] = "two"
sleep 1
render :text => "zero: #{session[:zero]}<br/>one: #{session[:one]}<br/>two: #{session[:two]}
<br/>three: #{session[:three]}"
end
def three
session[:three] = "three"
sleep 1
render :text => "zero: #{session[:zero]}<br/>one: #{session[:one]}<br/>two: #{session[:two]}
<br/>three: #{session[:three]}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment