Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Zhang <[email protected]>
  • Loading branch information
zmcNotafraid committed Dec 17, 2024
2 parents 45e23e1 + 62e9f11 commit de51e3d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
# - uses: satackey/[email protected]
# # Ignore the failure of a step and avoid terminating the job.
# continue-on-error: true
- name: Build and push
id: docker_build
uses: mr-smithers-excellent/docker-build-push@v5
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/v2/scripts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def ckb_transactions
base_query = CkbTransaction.joins(:cell_dependencies).
where(cell_dependencies: { contract_cell_id: contract_cell_ids }).
order("cell_dependencies.block_number DESC, cell_dependencies.tx_index DESC").
limit(10000)
limit(Settings.query_default_limit)
@ckb_transactions = CkbTransaction.from("(#{base_query.to_sql}) AS ckb_transactions").
order("block_number DESC, tx_index DESC").
page(@page).
Expand All @@ -43,7 +43,7 @@ def referring_cells

scope = Contract.referring_cells_query(@contracts).
order("block_timestamp DESC, cell_index DESC").
limit(10000)
limit(Settings.query_default_limit)
if params[:args].present?
type_script = TypeScript.find_by(args: params[:args])
scope = scope.or(CellOutput.where(type_script_id: type_script.id))
Expand Down
4 changes: 2 additions & 2 deletions app/interactions/addresses/ckb_transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def execute
raise AddressNotFoundError if address.is_a?(NullAddress)

address_id = address.map(&:id)
account_books = AccountBook.where(address_id:).order("ckb_transaction_id desc").select(:ckb_transaction_id).distinct.limit(5000)
account_books = AccountBook.where(address_id:).order("ckb_transaction_id desc").select(:ckb_transaction_id).distinct.limit(Settings.query_default_limit)
records = CkbTransaction.where(tx_status: :committed, id: account_books.map(&:ckb_transaction_id)).order(transactions_ordering).page(page).per(page_size)
options = paginate_options(records, address_id)
options.merge!(params: { previews: true, address: })
Expand All @@ -35,7 +35,7 @@ def transactions_ordering
def paginate_options(records, address_id)
total_count = AccountBook.where(address_id:).distinct.count
FastJsonapi::PaginationMetaGenerator.new(
request:, records:, page:, page_size:, total_count:,
request:, records:, page:, page_size:, total_pages: records.total_pages, total_count:,
).call
end

Expand Down
10 changes: 4 additions & 6 deletions app/workers/generate_udt_hourly_statistic_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ def generate_statistics(start_time)
def calc_amount(udt)
inputs_amount = 0
outputs_amount = 0
ckb_transaction_ids = udt.ckb_transactions.map(&:id)
ckb_transaction_ids.each_slice(5000) do |ids|
batch_inputs_amount = CellOutput.select(:udt_amount).where(consumed_by_id: ids).map(&:udt_amount).compact
inputs_amount += batch_inputs_amount.sum
batch_outputs_amount = CellOutput.select(:udt_amount).where(ckb_transaction_id: ids).map(&:udt_amount).compact
outputs_amount += batch_outputs_amount.sum
udt.ckb_transactions.includes(:cell_outputs).find_in_batches(batch_size: 1000) do |transactions|
ids = transactions.map(&:id)
inputs_amount += CellOutput.select(:udt_amount).where(consumed_by_id: ids).sum(:udt_amount)
outputs_amount += CellOutput.select(:udt_amount).where(ckb_transaction_id: ids).sum(:udt_amount)
end
[inputs_amount, outputs_amount].max
end
Expand Down
1 change: 1 addition & 0 deletions config/settings.mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type_id_code_hash: "0x0000000000000000000000000000000000000000000000000054595045
homepage_transactions_records_count: 15
homepage_block_records_count: 15
proposal_window: 10
query_default_limit: 5000

# rgbpp code hash
rgbpp_code_hash:
Expand Down
1 change: 1 addition & 0 deletions config/settings.testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ type_id_code_hash: "0x0000000000000000000000000000000000000000000000000054595045
homepage_transactions_records_count: 15
homepage_block_records_count: 15
proposal_window: 10
query_default_limit: 5000

# rgbpp code hash
rgbpp_code_hash:
Expand Down

0 comments on commit de51e3d

Please sign in to comment.