Skip to content

Commit

Permalink
Merge pull request #2034 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
zmcNotafraid authored Jul 5, 2024
2 parents a38c01d + 0fffb95 commit 82a0195
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 5 additions & 4 deletions app/workers/pool_transaction_check_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ class PoolTransactionCheckWorker

def perform
pending_transactions = CkbTransaction.tx_pending.where("created_at < ?",
2.minutes.ago)
2.minutes.ago).limit(100)
pending_transactions.each do |tx|
response_string = CkbSync::Api.instance.directly_single_call_rpc method: "get_transaction",
params: [tx.tx_hash]
reason = response_string["result"]["tx_status"]
if reason["status"] == "committed" && CkbTransaction.where(tx_hash: tx.tx_hash, tx_status: :committed).exists?
tx.destroy
end

if reason["status"] == "rejected"
ApplicationRecord.transaction do
Expand All @@ -27,6 +24,10 @@ def perform
tx.create_reject_reason!(message: "unknown")
end
end

if reason["status"] == "committed" && CkbTransaction.where(tx_hash: tx.tx_hash).count == 2 && CkbTransaction.where(tx_hash: tx.tx_hash, tx_status: :committed).exists?
tx.destroy

Check warning on line 29 in app/workers/pool_transaction_check_worker.rb

View check run for this annotation

Codecov / codecov/patch

app/workers/pool_transaction_check_worker.rb#L29

Added line #L29 was not covered by tests
end
end
end
end
4 changes: 0 additions & 4 deletions lib/scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ def call_worker(clz)
call_worker PoolTransactionCheckWorker
end

s.every "1h", overlap: false do
call_worker CleanUpWorker
end

s.interval "10s", overlap: false do
puts "reset transactions_count_per_minute, average_block_time, transaction_fee_rates"
StatisticInfo.default.reset! :transactions_count_per_minute,
Expand Down

0 comments on commit 82a0195

Please sign in to comment.