Skip to content

Commit

Permalink
Merge pull request #1361 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
rabbitz committed Aug 2, 2023
2 parents 2f07029 + 63fe95d commit 2f6b78f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
needs: build
strategy:
matrix:
workload: [ckb-explorer-api, ckb-explorer-poolsyncer, ckb-explorer-scheduler, ckb-explorer-blocksyncer]
workload: [ckb-explorer-api, ckb-explorer-poolsyncer, ckb-explorer-scheduler, ckb-explorer-blocksyncer, ckb-explorer-worker]
uses: ./.github/workflows/update-image.yml
with:
k8s-namespace: mainnet
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
needs: build
strategy:
matrix:
workload: [ckb-explorer-api, ckb-explorer-poolsyncer, ckb-explorer-scheduler, ckb-explorer-blocksyncer]
workload: [ckb-explorer-api, ckb-explorer-poolsyncer, ckb-explorer-scheduler, ckb-explorer-blocksyncer, ckb-explorer-worker]
uses: ./.github/workflows/update-image.yml
with:
k8s-namespace: staging
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
needs: build
strategy:
matrix:
workload: [ckb-explorer-api, ckb-explorer-poolsyncer, ckb-explorer-scheduler, ckb-explorer-blocksyncer]
workload: [ckb-explorer-api, ckb-explorer-poolsyncer, ckb-explorer-scheduler, ckb-explorer-blocksyncer, ckb-explorer-worker]
uses: ./.github/workflows/update-image.yml
with:
k8s-namespace: testnet
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/update-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ jobs:
data: '{"kind":"deployments","namespace":"${{ inputs.k8s-namespace }}","name":"${{ inputs.k8s-workload }}","images":{"${{ inputs.image-name }}":"${{ inputs.image-name }}:${{ inputs.image-tag }}"}}'
- name: Display Response
run: |
echo "Response response: ${{ steps.http-request.outputs.response }}"
echo "Response headers: ${{ steps.http-request.outputs.headers }}"
30 changes: 13 additions & 17 deletions lib/tasks/migration/update_output_cells_status.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,32 @@ class UpdateCellOutputsStatus
include Rake::DSL

def initialize
@address_ids = []

namespace :migration do
desc "Usage: RAILS_ENV=production bundle exec rake migration:update_output_cells_status"
task update_output_cells_status: :environment do
ApplicationRecord.transaction do
CellOutput.pending.includes(:ckb_transaction).where(ckb_transaction: { tx_status: "committed" }).find_each do |output|
puts "output id: #{output.id}"
CellOutput.includes(:ckb_transaction).pending.where(ckb_transaction: { tx_status: "committed" }).find_each do |output|
puts "output id: #{output.id}"

output.live!
update_udt_account(output)
@address_ids << output.address_id
end
output.live!
update_udt_account(output)
update_address_live_cells_count(output.address_id)
end

update_addresses_live_cells_count

puts "done"
end
end
end

private

def update_addresses_live_cells_count
Address.where(id: @address_ids.uniq).find_each do |address|
address.live_cells_count = address.cell_outputs.live.count
address.cal_balance!
address.save!
end
def update_address_live_cells_count(address_id)
address = Address.find_by_id address_id
return unless address

address.live_cells_count = address.cell_outputs.live.count
address.cal_balance!
address.save!
address.flush_cache
end

def update_udt_account(udt_output)
Expand Down

0 comments on commit 2f6b78f

Please sign in to comment.