diff --git a/app/workers/analyze_contract_from_cell_dependency_worker.rb b/app/workers/analyze_contract_from_cell_dependency_worker.rb index 9c2edd825..fb01a2782 100644 --- a/app/workers/analyze_contract_from_cell_dependency_worker.rb +++ b/app/workers/analyze_contract_from_cell_dependency_worker.rb @@ -1,12 +1,13 @@ class AnalyzeContractFromCellDependencyWorker include Sidekiq::Worker + sidekiq_options queue: "contract", retry: 0 def perform cell_deps_out_points_attrs = Set.new contract_attrs = Set.new cell_deps_attrs = Set.new - CellDependency.where(contract_analyzed: false).where.not(block_number: nil).order("block_number desc").limit(1000).each do |cell_dep| + CellDependency.where(contract_analyzed: false).where.not(block_number: nil).limit(1000).each do |cell_dep| cell_deps_attrs << { contract_analyzed: true, ckb_transaction_id: cell_dep.ckb_transaction_id, contract_cell_id: cell_dep.contract_cell_id, dep_type: cell_dep.dep_type } next if CellDepsOutPoint.where(contract_cell_id: cell_dep.contract_cell_id).exists? diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 7054f09af..f151bd024 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -7,6 +7,9 @@ - bitcoin - fiber - low + - contract +:limits: + contract: 1 production: :concurrency: 20 diff --git a/lib/scheduler.rb b/lib/scheduler.rb index 9afe16d6f..e5f6efb5f 100644 --- a/lib/scheduler.rb +++ b/lib/scheduler.rb @@ -128,7 +128,7 @@ def call_worker(clz) call_worker GenerateUdtHolderAllocationWorker end -s.every "5s", overlap: false do +s.every "10s", overlap: false do call_worker AnalyzeContractFromCellDependencyWorker end