Skip to content

Commit

Permalink
Merge pull request #2211 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
zmcNotafraid authored Sep 29, 2024
2 parents c1bb4d9 + f24cff6 commit 12dfe8c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/models/concerns/attr_logics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def define_logic(attr_name, &block)

def reset(*attr_names)
attr_names.flatten.each do |a|
Rails.logger.info("RESET ATTR #{a} STARTED AT: #{Time.now}")
reset_one a
Rails.logger.info("RESET ATTR #{a} ENDED AT: #{Time.now}")
end
end

Expand Down
2 changes: 0 additions & 2 deletions app/models/daily_statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,11 @@ def liquidity
end

define_logic :holder_count do
ActiveRecord::Base.connection.execute("SET statement_timeout = 0")
live_query = CellOutput.live.generated_before(to_be_counted_date.to_i * 1000 - 1).select(:address_id).to_sql
dead_query = CellOutput.dead.generated_before(to_be_counted_date.to_i * 1000 - 1).consumed_after(to_be_counted_date.to_i * 1000).select(:address_id).to_sql
combined_query = "#{live_query} UNION #{dead_query}"
count_query = "SELECT COUNT(DISTINCT address_id) AS count FROM (#{combined_query}) AS combined_results;"
count = ActiveRecord::Base.connection.execute(count_query).first["count"]
ActiveRecord::Base.connection.execute("RESET statement_timeout")
count
end

Expand Down
2 changes: 2 additions & 0 deletions app/workers/charts/daily_statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ def perform(datetime = nil)
start_time = Time.zone.at(last_record ? last_record.created_at_unixtimestamp : Block.find_by(number: 0).timestamp / 1000)
while start_time < datetime
start_time += 1.day
ActiveRecord::Base.connection.execute("SET statement_timeout = 0")
Charts::DailyStatisticGenerator.new(start_time).call
ActiveRecord::Base.connection.execute("RESET statement_timeout")
end
end
end
Expand Down

0 comments on commit 12dfe8c

Please sign in to comment.