Skip to content

Commit

Permalink
fix: revert is too slowly
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Zhang <[email protected]>
  • Loading branch information
zmcNotafraid committed Nov 20, 2024
1 parent 757cb72 commit 6cf35d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions app/models/block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def self.query_transaction_fee_rate(date_string)

def self.fetch_transaction_fee_rate_from_cache(date_string)
Rails.cache.fetch("transaction_fee_rate_#{date_string}", expires_in: 10.minutes) do
self.query_transaction_fee_rate date_string
query_transaction_fee_rate date_string
end
end

Expand Down Expand Up @@ -227,7 +227,7 @@ def block_index_in_epoch
end

def fraction_epoch
OpenStruct.new(number: epoch, index: block_index_in_epoch, length: length)
OpenStruct.new(number: epoch, index: block_index_in_epoch, length:)
end

def self.find_block!(query_key)
Expand Down Expand Up @@ -261,7 +261,7 @@ def self.largest_in_epoch(epoch_number)
if b&.block_size
{
number: b.number,
bytes: b.block_size
bytes: b.block_size,
}
end
end
Expand Down Expand Up @@ -310,7 +310,7 @@ def self.update_block_median_timestamp(block_number)
end

def update_counter_for_ckb_node_version
witness = self.cellbase.witnesses[0].data
witness = cellbase.witnesses[0].data
return if witness.blank?

matched = [witness.gsub("0x", "")].pack("H*").match(/\d\.\d+\.\d/)
Expand All @@ -325,7 +325,7 @@ def update_counter_for_ckb_node_version

# update the current block's ckb_node_version
self.ckb_node_version = matched[0]
self.save!
save!
end

# NOTICE: this method would do a fresh calculate for all the block's ckb_node_version, it will:
Expand Down
6 changes: 3 additions & 3 deletions app/models/ckb_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class CkbTransaction < ApplicationRecord
has_many :inputs, class_name: "CellOutput", inverse_of: "consumed_by", foreign_key: "consumed_by_id"
has_many :outputs, class_name: "CellOutput"
has_many :dao_events # , dependent: :delete_all
has_many :script_transactions, dependent: :delete_all
has_many :scripts, through: :script_transactions
# has_many :script_transactions, dependent: :delete_all
# has_many :scripts, through: :script_transactions

has_many :referring_cells, dependent: :delete_all
has_many :token_transfers, foreign_key: :transaction_id, dependent: :delete_all, inverse_of: :ckb_transaction
has_many :cell_dependencies, dependent: :delete_all
# has_many :cell_dependencies, dependent: :delete_all
has_many :header_dependencies, dependent: :delete_all
has_many :witnesses, dependent: :delete_all

Expand Down

0 comments on commit 6cf35d0

Please sign in to comment.