This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SecretKey | |
protected | |
def fix_plumbing(*args) | |
_fix_plumbing(*args) if defined?(:_fix_plumbing) | |
end | |
def twist_knob | |
_twist_knob if defined?(:_twist_knob) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
Pre-Process - my Fiber is 2166354320 | |
--- | |
CHECKING USER - my Fiber is 2166354320 | |
Querying on fiber 2166354320 | |
callback chain? | |
auth is back | |
WOOT NO ERROR - 2174548140 | |
ABOUT TO SAVE - my Fiber is 2174548140 | |
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MongoAuth | |
include Goliath::Rack::AsyncMiddleware | |
include Goliath::Validation | |
include Goliath::Rack::Validator | |
class MissingApikeyError < BadRequestError ; end | |
class DatabaseSaveError < BadRequestError ; end | |
class RateLimitExceededError < ForbiddenError ; end | |
class UserIDMismatchError < UnauthorizedError ; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# added output to test the state at query and result | |
# | |
def query(sql, opts={}) | |
puts "#{Time.now.to_f}\t#{Fiber.current.object_id}\tQUERY: #{sql}" | |
if ::EM.reactor_running? | |
super(sql, opts.merge(:async => true)) | |
deferrable = ::EM::DefaultDeferrable.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Can't install mysql2 gem.. | |
Using mysql2 (0.3.3) from https://github.com/brianmario/mysql2.git (at master) with native extensions /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) | |
/usr/local/bin/ruby extconf.rb | |
checking for rb_thread_blocking_region()... yes | |
checking for mysql_query() in -lmysqlclient... no | |
checking for main() in -lm... yes | |
checking for mysql_query() in -lmysqlclient... no | |
checking for main() in -lz... yes | |
checking for mysql_query() in -lmysqlclient... no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def queue | |
@json_headers = { "Content-Type" => 'application/json', 'Accept' => 'application/json'} | |
if ::EM.reactor_running? | |
# EM.synchrony do #start a new fiber... | |
req = EM::HttpRequest.new(@@dispatcher_url) | |
puts "dispatching worker #{@body}" | |
req.apost({:head=>@json_headers, :body=>JSON.generate(@body)}) | |
req.callback do | |
puts "dispatch worker - success!!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl http://localhost:9000/photos -X POST -F "[email protected]" |