Class: Solrengine::Sdp::MintJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/solrengine/sdp/mint_job.rb

Overview

Sends a single mint to SDP, off the web request. The mint POST is NEVER retried — SDP has no idempotency key, so a blind re-send risks a double-mint. The atomic claim (minting → in_flight) means a crash + queue-retry, or two workers racing the same row, can never send twice: only the claim winner POSTs; a row already claimed is left as-is.

Transport failures are handled INSIDE TokenMint#submit_to_sdp! (Timeout → unknown, Unavailable → failed), so this job never raises for an automatic retry to catch.

Inherits ActiveJob::Base directly so the engine never depends on the host app’s ApplicationJob (same posture as ProvisionWalletJob).

Instance Method Summary collapse

Instance Method Details

#perform(mint) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/jobs/solrengine/sdp/mint_job.rb', line 23

def perform(mint)
  return unless mint.claim! # false → already attempted; never re-send

  mint.submit_to_sdp!
  # App-initiated issuance is its own doorbell. The chain-WebSocket
  # watcher only sees a wallet's native account, not the token ATA a
  # mint credits, so it never rings for an earn — but WE know the mint
  # just landed. Ring the balance broadcast directly (every earn,
  # including the first). A broadcast failure must never fail a settled
  # mint: the money already moved.
  broadcast_balance(mint.destination) if mint.minted?
end