This commit is contained in:
yuanke 2016-11-03 10:41:51 +08:00
parent 8bf6ef4371
commit a075b6d237
2 changed files with 13 additions and 2 deletions

View File

@ -37,10 +37,13 @@ module AccountHelper
# Automatic activation # Automatic activation
user.activate user.activate
user.last_login_on = Time.now user.last_login_on = Time.now
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
Rails.logger.info "register_130 wait time = #{tUsedtime} ms"
if user.save if user.save
tEndtime = Time.now tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
Rails.logger.info "register_130 wait time = #{tUsedtime} ms" Rails.logger.info "register_131 wait time = #{tUsedtime} ms"
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
#self.logged_user = user #self.logged_user = user
#flash[:notice] = l(:notice_account_activated) #flash[:notice] = l(:notice_account_activated)
@ -50,7 +53,7 @@ module AccountHelper
end end
tEndtime = Time.now tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
Rails.logger.info "register_131 wait time = #{tUsedtime} ms" Rails.logger.info "register_132 wait time = #{tUsedtime} ms"
user user
end end

View File

@ -488,9 +488,13 @@ class User < Principal
def update_hashed_password def update_hashed_password
# update hashed_password if password was set # update hashed_password if password was set
tStarttime = Time.now
if self.password && self.auth_source_id.blank? if self.password && self.auth_source_id.blank?
salt_password(password) salt_password(password)
end end
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
Rails.logger.info "update_hashed_password wait time = #{tUsedtime} ms"
end end
alias :base_reload :reload alias :base_reload :reload
@ -1287,9 +1291,13 @@ class User < Principal
end end
end end
def update_user_ealasticsearch_index def update_user_ealasticsearch_index
tStarttime = Time.now
if self.id != 2 && self.id != 4 if self.id != 2 && self.id != 4
self.__elasticsearch__.update_document if Rails.env.production? self.__elasticsearch__.update_document if Rails.env.production?
end end
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
Rails.logger.info "update_elastic wait time = #{tUsedtime} ms"
end end
def delete_user_ealasticsearch_index def delete_user_ealasticsearch_index
if self.id != 2 && self.id != 4 if self.id != 2 && self.id != 4