class StellarSpectrum::Unlocking::AttemptRelease

Constants

WAIT_TIME_IN_SECONDS

Public Class Methods

actions() click to toggle source
# File lib/stellar_spectrum/services/unlocking/attempt_release.rb, line 29
def self.actions
  [
    GetLockedAccounts,
    GetChannelAccountInfo,
    GetSequenceNumber,
    CheckSequenceNumber,
    Unlock,
  ]
end
call(redis:, channel_accounts:, channel_account:, stellar_client:) click to toggle source
# File lib/stellar_spectrum/services/unlocking/attempt_release.rb, line 8
def self.call(redis:, channel_accounts:, channel_account:, stellar_client:)
  result = with(
    stellar_client: stellar_client,
    redis: redis,
    channel_account: channel_account,
    channel_accounts: channel_accounts,
  ).reduce(actions)

  if result.failure?
    sleep WAIT_TIME_IN_SECONDS
    result = self.(
      stellar_client: stellar_client,
      redis: redis,
      channel_account: channel_account,
      channel_accounts: channel_accounts,
    )
  end

  result
end