Permalink
Please sign in to comment.
Showing
with
2 additions
and 47 deletions.
- +0 −4 app/controllers/signup_controller.rb
- +0 −3 app/controllers/stories_controller.rb
- +1 −5 app/models/comment.rb
- +1 −1 config/application.rb
- +0 −34 extras/countinual.rb
| @@ -1,34 +0,0 @@ | ||
| require "socket" | ||
| class Countinual | ||
| cattr_accessor :API_KEY | ||
| # this needs to be overridden in config/initializers/production.rb | ||
| @@API_KEY = nil | ||
| COUNTINUAL_HOST = "170.130.139.180" | ||
| COUNTINUAL_PORT = 1025 | ||
| def self.count!(counter, value, time = nil) | ||
| if !@@API_KEY | ||
| return | ||
| end | ||
| if time | ||
| time = time.to_i | ||
| else | ||
| time = Time.now.to_i | ||
| end | ||
| line = "#{@@API_KEY} #{counter} #{value} #{time}\n" | ||
| begin | ||
| sock = UDPSocket.open | ||
| sock.send(line, 0, COUNTINUAL_HOST, COUNTINUAL_PORT) | ||
| rescue => e | ||
| Rails.logger.info "Countinual error: #{e.message} (#{line.inspect})" | ||
| ensure | ||
| sock.close | ||
| end | ||
| end | ||
| end |
0 comments on commit
83b0cce