* remove crazy debugging from base manager

This commit is contained in:
Seth Call 2016-03-28 20:13:17 -05:00
parent c9c384cbf0
commit a6c054635d
2 changed files with 5 additions and 14 deletions

View File

@ -4,7 +4,11 @@ module JamRuby
attr_accessor :pg_conn
@@log = Logging.logger[BaseManager]
@@in_websocket_gateway = Rails.env != 'test' && !Object.const_defined?(:UserManager)
# this is not working as expected
#@@in_websocket_gateway = Rails.env != 'test' && !Object.const_defined?(:UserManager)
@@in_websocket_gateway = false
def initialize(options={})
@log = Logging.logger[self]
@ -19,12 +23,10 @@ module JamRuby
def self.active_record_transaction
manager = self.new
@@log.error "DEBUG_TRAN S"
ActiveRecord::Base.connection_pool.with_connection do |connection|
# create a transaction, and pass the current connection to ConnectionManager.
# this lets the entire operation work with the same transaction,
# across Rails ActiveRecord and the pg-gem based code in ConnectionManager.
@@log.error "DEBUG_TRAN -1"
manager.pg_conn = connection.instance_variable_get("@connection")
if @@in_websocket_gateway
@ -37,9 +39,7 @@ module JamRuby
ActiveRecord::Base.connection.execute('ROLLBACK')
end
else
@@log.error "DEBUG_TRAN -2"
connection.transaction do
@@log.error "DEBUG_TRAN -3"
yield manager
end
end

View File

@ -405,17 +405,12 @@ SQL
def join_music_session(user, client_id, music_session, as_musician, tracks, audio_latency, video_sources=nil)
connection = nil
@log.error "DEBUG_TRAN 1"
ConnectionManager.active_record_transaction do |connection_manager|
@log.error "DEBUG_TRAN 2"
db_conn = connection_manager.pg_conn
@log.error "DEBUG_TRAN 3"
connection = Connection.find_by_client_id_and_user_id!(client_id, user.id)
@log.error "DEBUG_TRAN 4"
connection.join_the_session(music_session, as_musician, tracks, user, audio_latency, video_sources)
@log.error "DEBUG_TRAN 5"
JamRuby::MusicSessionUserHistory.join_music_session(user.id, music_session.id)
# connection.music_session_id = music_session.id
# connection.as_musician = as_musician
@ -423,19 +418,15 @@ SQL
# connection.joined_session_at = Time.now
# associate_tracks(connection, tracks)
# connection.save
@log.error "DEBUG_TRAN 6"
if connection.errors.any?
@log.error "DEBUG_TRAN 7"
raise ActiveRecord::Rollback
else
@log.error "DEBUG_TRAN 8"
update_session_controller(music_session.id)
end
end
@log.error "DEBUG_TRAN 9"
connection
end