Class: StellarSpectrum::Unlocking::AttemptRelease

Inherits:
Object
  • Object
show all
Extended by:
LightService::Organizer
Defined in:
lib/stellar_spectrum/services/unlocking/attempt_release.rb

Constant Summary collapse

WAIT_TIME_IN_SECONDS =
5

Class Method Summary collapse

Class Method Details

.actionsObject



29
30
31
32
33
34
35
36
37
# 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:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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_accounts: channel_accounts,
  ).reduce(actions)

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

  result
end