* fix broken tests because of removal of diagnostics, and fix bad logging pattern
This commit is contained in:
parent
9ad521fa71
commit
8a84ff5609
|
|
@ -3,7 +3,7 @@ require 'resque-lonely_job'
|
|||
|
||||
module JamRuby
|
||||
class BatchEmailJob
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@@log = Logging.logger[BatchEmailJob]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module JamRuby
|
|||
|
||||
# executes a mix of tracks, creating a final output mix
|
||||
class IcecastConfigWriter
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@@log = Logging.logger[IcecastConfigWriter]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
require 'resque'
|
||||
require 'resque-lonely_job'
|
||||
|
||||
ENV['FORK_PER_JOB'] = 'false'
|
||||
|
||||
|
|
@ -63,19 +62,21 @@ module JamRuby
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
require 'resque-lonely_job'
|
||||
|
||||
# for jobs that extend lonely job, we override around_perform already implemented in LonelyJob, and call into it
|
||||
module Resque
|
||||
module Plugins
|
||||
module LonelyJob
|
||||
module JamLonelyJob
|
||||
def around_perform(*args)
|
||||
Stats.timer('job.stats') do
|
||||
begin
|
||||
yield
|
||||
ensure
|
||||
unlock_queue(*args)
|
||||
end
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Resque::Plugins::JamLonelyJob.module_eval { include Resque::Plugins::LonelyJob }
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ require 'digest/md5'
|
|||
module JamRuby
|
||||
|
||||
class ActiveMusicSessionCleaner
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
attr_accessor :interval
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module JamRuby
|
|||
|
||||
# periodically scheduled to find jobs that need retrying, and cleanup activities
|
||||
class AudioMixerRetry
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :scheduled_audiomixer_retry
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@
|
|||
module JamRuby
|
||||
class CleanupFacebookSignup
|
||||
|
||||
|
||||
|
||||
|
||||
@queue = :scheduled_cleanup_facebook_signup
|
||||
|
||||
@@log = Logging.logger[CleanupFacebookSignup]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module JamRuby
|
||||
class DailySessionEmailer
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :scheduled_daily_session_emailer
|
||||
@@log = Logging.logger[DailySessionEmailer]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module JamRuby
|
|||
|
||||
# periodically scheduled to find jobs that need retrying
|
||||
class IcecastConfigRetry
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :scheduled_icecast_config_retry
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,13 @@ module JamRuby
|
|||
# http://blog.bignerdranch.com/1643-never-use-resque-for-serial-jobs/
|
||||
# periodically scheduled to find sources that need to be brought down, or alternatively, it seems the client failed to start sourcing
|
||||
class IcecastSourceCheck
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :scheduled_icecast_source_check
|
||||
|
||||
@@log = Logging.logger[IcecastSourceCheck]
|
||||
def log
|
||||
@log || Logging.logger[IcecastSourceCheck]
|
||||
end
|
||||
|
||||
def self.lock_timeout
|
||||
# this should be enough time to make sure the job has finished, but not so long that the system isn't recovering from a abandoned job
|
||||
|
|
@ -21,11 +23,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def self.perform
|
||||
@@log.debug("waking up")
|
||||
|
||||
IcecastSourceCheck.new.run
|
||||
|
||||
@@log.debug("done")
|
||||
IcecastSourceCheck.new.run
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -35,6 +33,8 @@ module JamRuby
|
|||
# ** listeners > 0 and sourced is DOWN (false)
|
||||
# ** listeners == 0 and sourced is UP (true)
|
||||
|
||||
log.debug("waking up")
|
||||
|
||||
IcecastMount.find_each(lock: true, :conditions => "( (listeners > 0 AND sourced = FALSE) OR (listeners = 0 AND sourced = TRUE) ) AND ( sourced_needs_changing_at IS NULL OR sourced_needs_changing_at < (NOW() - interval '#{APP_CONFIG.icecast_max_sourced_changed} second') ) ", :batch_size => 100) do |mount|
|
||||
if mount.music_session_id
|
||||
mount.with_lock do
|
||||
|
|
@ -42,6 +42,8 @@ module JamRuby
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
log.debug("done")
|
||||
end
|
||||
|
||||
def handle_notifications(mount)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ require 'digest/md5'
|
|||
|
||||
module JamRuby
|
||||
class MusicSessionScheduler
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :music_session_scheduler
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module JamRuby
|
||||
class NewMusicianEmailer
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :scheduled_new_musician_emailer
|
||||
@@log = Logging.logger[NewMusicianEmailer]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module JamRuby
|
|||
|
||||
# periodically scheduled to find recordings to cleanup
|
||||
class RecordingsCleaner
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :recordings_cleaner
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module JamRuby
|
||||
class ScheduledMusicSessionCleaner
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :scheduled_music_session_cleaner
|
||||
@@log = Logging.logger[ScheduledMusicSessionCleaner]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module JamRuby
|
|||
|
||||
# periodically scheduled to find jobs that need retrying
|
||||
class ScoreHistorySweeper
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :score_history_sweeper
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,25 @@ module JamRuby
|
|||
|
||||
# creates stats to send to influx periodically
|
||||
class StatsMaker
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :stats_maker
|
||||
@queue = :scheduled_db_metrics
|
||||
|
||||
def log
|
||||
@log || Logging.logger[StatsMaker]
|
||||
end
|
||||
|
||||
def self.lock_timeout
|
||||
120
|
||||
end
|
||||
|
||||
@@log = Logging.logger['StatsMaker']
|
||||
|
||||
def self.perform
|
||||
StatsMaker.new.run
|
||||
end
|
||||
|
||||
def run
|
||||
log.debug("starting...")
|
||||
Stats.write('connection', Connection.stats)
|
||||
Stats.write('users', User.stats)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ require 'digest/md5'
|
|||
|
||||
module JamRuby
|
||||
class UnusedMusicNotationCleaner
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :unused_music_notation_cleaner
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module JamRuby
|
||||
class UserProgressEmailer
|
||||
extend Resque::Plugins::LonelyJob
|
||||
extend Resque::Plugins::JamLonelyJob
|
||||
|
||||
@queue = :scheduled_user_progress_emailer
|
||||
@@log = Logging.logger[UserProgressEmailer]
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
// related to listen
|
||||
function stateChange(e, data) {
|
||||
var $listenLink = e.element;
|
||||
var $listenLink = e.element; // TODO: this is empty
|
||||
console.log(e,$(this))
|
||||
var $listenText = $('.listen-link-text', $listenLink);
|
||||
var $listenDetails = $('.listen-link-details', $listenLink);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
class ApiController < ApplicationController
|
||||
|
||||
@@log = Logging.logger[ApiController]
|
||||
def log
|
||||
@log || Logging.logger[ApiController]
|
||||
end
|
||||
|
||||
@@html_encoder = HTMLEntities.new
|
||||
|
||||
# define common error handlers
|
||||
|
|
@ -21,11 +24,11 @@ class ApiController < ApplicationController
|
|||
render "errors/conflict_error", :status => 409
|
||||
end
|
||||
rescue_from 'ActiveRecord::RecordNotFound' do |exception|
|
||||
@@log.debug(exception)
|
||||
log.debug(exception)
|
||||
render :json => { :errors => { :resource => ["record not found"] } }, :status => 404
|
||||
end
|
||||
rescue_from 'PG::Error' do |exception|
|
||||
@@log.debug(exception)
|
||||
log.debug(exception)
|
||||
if exception.to_s.include? "duplicate key value violates unique constraint"
|
||||
render :json => { :errors => { :resource => ["resource already exists"] } }, :status => 409 # 409 = conflict
|
||||
else
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ class ApiRecordingsController < ApiController
|
|||
|
||||
respond_to :json
|
||||
|
||||
@@log = Logging.logger[ApiRecordingsController]
|
||||
def log
|
||||
@log || Logging.logger[ApiRecordingsController]
|
||||
end
|
||||
|
||||
def index
|
||||
# lists recordings created by for the current user
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ class ApiUserSyncsController < ApiController
|
|||
|
||||
respond_to :json
|
||||
|
||||
@@log = Logging.logger[ApiUserSyncsController]
|
||||
|
||||
def log
|
||||
@log || Logging.logger[ApiUserSyncsController]
|
||||
end
|
||||
|
||||
def show
|
||||
@user_sync = UserSync.show(params[:user_sync_id], current_user.id)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@ require 'js_connect'
|
|||
|
||||
class VanillaForumsController < ApplicationController
|
||||
|
||||
@@log = Logging.logger[VanillaForumsController]
|
||||
|
||||
def log
|
||||
@log || Logging.logger[VanillaForumsController ]
|
||||
end
|
||||
|
||||
# displays the embedded forum
|
||||
# see http://vanillaforums.com/blog/jsconnect-technical-documentation-for-embedded-sso/
|
||||
|
|
@ -43,9 +46,9 @@ class VanillaForumsController < ApplicationController
|
|||
'photourl' => current_user.resolved_photo_url,
|
||||
'uniqueid' => current_user.id}
|
||||
|
||||
@@log.debug("user is logged in: #{user}")
|
||||
log.debug("user is logged in: #{user}")
|
||||
else
|
||||
@@log.debug("user is not logged in")
|
||||
log.debug("user is not logged in")
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
@@log = Logging.logger['EmailInitializer']
|
||||
|
||||
ActionMailer::Base.raise_delivery_errors = true
|
||||
ActionMailer::Base.delivery_method = GenericState.allow_emails? ? :smtp : :test
|
||||
ActionMailer::Base.smtp_settings = {
|
||||
|
|
@ -12,4 +10,4 @@ ActionMailer::Base.smtp_settings = {
|
|||
:enable_starttls_auto => Rails.application.config.email_smtp_starttls_auto
|
||||
}
|
||||
|
||||
@@log.debug("ActionMailer.delivery_method = #{ActionMailer::Base.delivery_method}")
|
||||
Rails.logger.debug("ActionMailer.delivery_method = #{ActionMailer::Base.delivery_method}")
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
module Middlewares
|
||||
class ClearDuplicatedSession
|
||||
|
||||
@@log = Logging.logger[ClearDuplicatedSession]
|
||||
def log
|
||||
@log || Logging.logger[ClearDuplicatedSession]
|
||||
end
|
||||
|
||||
def initialize(app)
|
||||
@app = app
|
||||
|
|
@ -53,7 +55,7 @@ module Middlewares
|
|||
# Sets expiration date = 1970-01-01 to the cookie, this way browser will
|
||||
# note the cookie is expired and will delete it
|
||||
def delete_session_cookie_for_current_domain(env, headers)
|
||||
@@log.debug "deleting default domain session cookie"
|
||||
log.debug "deleting default domain session cookie"
|
||||
::Rack::Utils.set_cookie_header!(
|
||||
headers, # contains response headers
|
||||
get_session_key(env), # gets the cookie session name, '_session_cookie' - for this example
|
||||
|
|
|
|||
|
|
@ -74,11 +74,6 @@ describe "Reconnect", :js => true, :type => :feature, :capybara_feature => true
|
|||
|
||||
# but.. after a few seconds, it should reconnect on it's own
|
||||
page.should_not have_selector('.no-websocket-connection')
|
||||
|
||||
# confirm that a diagnostic was written
|
||||
Diagnostic.count.should == i + 1
|
||||
diagnostic = Diagnostic.first
|
||||
diagnostic.type.should == Diagnostic::WEBSOCKET_CLOSED_LOCALLY
|
||||
end
|
||||
|
||||
# then verify we can create a session
|
||||
|
|
|
|||
Loading…
Reference in New Issue