remove dead Countinual code

This commit is contained in:
Peter Bhat Harkins 2017-11-27 10:16:18 -05:00
parent 91ded85364
commit 83b0cced0a
5 changed files with 2 additions and 47 deletions

View File

@ -51,10 +51,6 @@ class SignupController < ApplicationController
flash[:success] = "Welcome to #{Rails.application.name}, " <<
"#{@new_user.username}!"
Countinual.count!("#{Rails.application.shortname}.users.created", "+1")
Countinual.count!("#{Rails.application.shortname}.users.total",
User.count)
return redirect_to "/signup/invite"
else
render :action => "invited"

View File

@ -18,9 +18,6 @@ class StoriesController < ApplicationController
if @story.valid? && !(@story.already_posted_story && !@story.seen_previous)
if @story.save
Countinual.count!("#{Rails.application.shortname}.stories.submitted",
"+1")
return redirect_to @story.comments_path
end
end

View File

@ -19,7 +19,7 @@ class Comment < ActiveRecord::Base
end
after_create :record_initial_upvote, :mark_submitter,
:deliver_reply_notifications, :deliver_mention_notifications,
:log_to_countinual, :log_hat_use
:log_hat_use
after_destroy :unassign_votes
scope :active, -> { where(:is_deleted => false, :is_moderated => false) }
@ -369,10 +369,6 @@ class Comment < ActiveRecord::Base
m.save!
end
def log_to_countinual
Countinual.count!("#{Rails.application.shortname}.comments.submitted", "+1")
end
def mark_submitter
Keystore.increment_value_for("user:#{self.user_id}:comments_posted")
end

View File

@ -74,7 +74,7 @@ class << Rails.application
})
end
# used as mailing list prefix and countinual prefix, cannot have spaces
# used as mailing list prefix, cannot have spaces
def shortname
name.downcase.gsub(/[^a-z]/, "")
end

View File

@ -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