Skip to content

Instantly share code, notes, and snippets.

@RStankov
Created November 28, 2024 14:08
Show Gist options
  • Save RStankov/85afcee3b23a1acde27ccd51233f9c4b to your computer and use it in GitHub Desktop.
Save RStankov/85afcee3b23a1acde27ccd51233f9c4b to your computer and use it in GitHub Desktop.
batch = AngryBatch.new label: 'BulkWithdraw'
# check inherits from ActiveJob::Base
batch.on_complete Finance::WithdrawBulkCompleteJob, bulk_withdraw
zerod_fees do |fee|
# check inherits from ActiveJob::Base
# check job includes AngryJob::Batchable
batch.enqueue Taxation::MaintenanceTaxAutoAdjustmentJob, bulk_withdraw, fee: fee, amount: 0
end
bulk_withdraw.withdraws.each do
batch.enqueue Taxation::GeneratePaymentDocumentJob, _1
batch.enqueue Taxation::MaintenanceTaxAutoAdjustmentJob, _1
end
# can do `perform_now`
batch.perform_later
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment