diff --git a/setup.go b/setup.go index fe4de03..852d460 100644 --- a/setup.go +++ b/setup.go @@ -46,11 +46,19 @@ func (s *Sync) walletSetup() error { minBalance := (float64(numOnSource)-float64(numPublished))*publishAmount + channelClaimAmount amountToAdd, _ := decimal.NewFromFloat(minBalance).Sub(balance).Float64() + amountToAdd *= 1.5 // add 50% margin for fees, future publishes, etc + + if s.Refill > 0 { + if amountToAdd < 0 { + amountToAdd = float64(s.Refill) + } else { + amountToAdd += float64(s.Refill) + } + } if amountToAdd > 0 { - amountToAdd *= 1.5 // add 50% margin for fees, future publishes, etc if amountToAdd < 1 { - amountToAdd = 1 + amountToAdd = 1 // no reason to bother adding less than 1 credit } s.addCredits(amountToAdd) } diff --git a/ytsync.go b/ytsync.go index d56d04a..e0822a6 100644 --- a/ytsync.go +++ b/ytsync.go @@ -55,6 +55,7 @@ type Sync struct { MaxTries int ConcurrentVideos int TakeOverExistingChannel bool + Refill int daemon *jsonrpc.Client claimAddress string @@ -123,7 +124,7 @@ func (s *Sync) FullCycle() error { signal.Notify(interruptChan, os.Interrupt, syscall.SIGTERM) go func() { <-interruptChan - log.Println("Got interrupt signal. Will shut down after current publishes finish") + log.Println("Got interrupt signal, shutting down (if publishing, will shut down after current publish)") s.stop.Stop() }()