Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keep unique analyze job #2310

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/workers/analyze_contract_from_cell_dependency_worker.rb
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
3 changes: 3 additions & 0 deletions config/sidekiq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- bitcoin
- fiber
- low
- contract
:limits:
contract: 1

production:
:concurrency: 20
Expand Down
2 changes: 1 addition & 1 deletion lib/scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading