From a075b6d237d0d913c90d690802a22b04484e42df Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 3 Nov 2016 10:41:51 +0800 Subject: [PATCH] =?UTF-8?q?.=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/account_helper.rb | 7 +++++-- app/models/user.rb | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index b490c6a51..fd10c06a4 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -37,10 +37,13 @@ module AccountHelper # Automatic activation user.activate 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 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" + Rails.logger.info "register_131 wait time = #{tUsedtime} ms" UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) #self.logged_user = user #flash[:notice] = l(:notice_account_activated) @@ -50,7 +53,7 @@ module AccountHelper end tEndtime = Time.now 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 end diff --git a/app/models/user.rb b/app/models/user.rb index 0bcd04f26..65eb1992c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -488,9 +488,13 @@ class User < Principal def update_hashed_password # update hashed_password if password was set + tStarttime = Time.now if self.password && self.auth_source_id.blank? salt_password(password) 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 alias :base_reload :reload @@ -1287,9 +1291,13 @@ class User < Principal end end def update_user_ealasticsearch_index + tStarttime = Time.now if self.id != 2 && self.id != 4 self.__elasticsearch__.update_document if Rails.env.production? 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 def delete_user_ealasticsearch_index if self.id != 2 && self.id != 4