Remove any fatal error messages to prevent crashes
This commit is contained in:
@@ -64,13 +64,24 @@ func MainApp(configPath string) {
|
|||||||
repoClient4 := http.NewHTTPClient("", 0, 1, false, []string{}, proxyURL, log.Named("network_test"))
|
repoClient4 := http.NewHTTPClient("", 0, 1, false, []string{}, proxyURL, log.Named("network_test"))
|
||||||
repoClient6 := http.NewHTTPClient("", 0, 1, true, []string{}, proxyURL, log.Named("network_test"))
|
repoClient6 := http.NewHTTPClient("", 0, 1, true, []string{}, proxyURL, log.Named("network_test"))
|
||||||
repo := http.NewIPRepository(repoClient4, repoClient6, "", log.Named("network_test"))
|
repo := http.NewIPRepository(repoClient4, repoClient6, "", log.Named("network_test"))
|
||||||
repo.NetworkTest(false, config.ShouldCacheNetworkTestResults())
|
|
||||||
|
|
||||||
hosts := repo.GetHosts(config.GetNumberOfHosts(), config.ShouldForceIPv6())
|
var hosts []string
|
||||||
|
repo.NetworkTest(false, config.ShouldCacheNetworkTestResults())
|
||||||
|
hosts = repo.GetHosts(config.GetNumberOfHosts(), config.ShouldForceIPv6())
|
||||||
if len(hosts) == 0 {
|
if len(hosts) == 0 {
|
||||||
zurglog.Fatal("No reachable hosts found. We cannot continue! (check if Real-Debrid is down or they have blocked your IP address)")
|
zurglog.Errorf("No reachable hosts found. Trying again.")
|
||||||
|
for {
|
||||||
|
repo.NetworkTest(true, config.ShouldCacheNetworkTestResults())
|
||||||
|
hosts = repo.GetHosts(config.GetNumberOfHosts(), config.ShouldForceIPv6())
|
||||||
|
if len(hosts) == 0 {
|
||||||
|
zurglog.Errorf("No reachable hosts found. Trying again in 5 minutes.")
|
||||||
|
time.Sleep(5 * time.Minute)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
zurglog.Debugf("Reachable hosts (%d): %v", len(hosts), hosts)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
zurglog.Debugf("Reachable hosts (%d): %v", len(hosts), hosts)
|
|
||||||
|
|
||||||
apiClient := http.NewHTTPClient(
|
apiClient := http.NewHTTPClient(
|
||||||
config.GetToken(),
|
config.GetToken(),
|
||||||
|
|||||||
@@ -14,15 +14,22 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func MonitorPremiumStatus(workerPool *ants.Pool, rd *realdebrid.RealDebrid, zurglog *logutil.Logger) {
|
func MonitorPremiumStatus(workerPool *ants.Pool, rd *realdebrid.RealDebrid, zurglog *logutil.Logger) {
|
||||||
userInfo, err := rd.GetUserInformation()
|
var userInfo *realdebrid.User
|
||||||
if err != nil {
|
var err error
|
||||||
zurglog.Fatalf("Failed to get user information: %v", err)
|
for {
|
||||||
|
userInfo, err = rd.GetUserInformation()
|
||||||
|
if err != nil {
|
||||||
|
zurglog.Errorf("Failed to get user information: %v trying again in 30 seconds", err)
|
||||||
|
time.Sleep(30 * time.Second)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
workerPool.Submit(func() {
|
workerPool.Submit(func() {
|
||||||
for {
|
for {
|
||||||
if userInfo.Premium <= MINIMUM_SLEEP {
|
if userInfo.Premium <= MINIMUM_SLEEP {
|
||||||
zurglog.Fatal("Your account is no longer premium, exiting...")
|
zurglog.Errorf("YOUR ACCOUNT IS NO LONGER PREMIUM. PLEASE RENEW YOUR SUBSCRIPTION.")
|
||||||
} else {
|
} else {
|
||||||
if userInfo.Premium <= PREMIUM_THRESHOLD {
|
if userInfo.Premium <= PREMIUM_THRESHOLD {
|
||||||
zurglog.Warnf("Your account will expire in %d hours", userInfo.Premium/3600)
|
zurglog.Warnf("Your account will expire in %d hours", userInfo.Premium/3600)
|
||||||
|
|||||||
Reference in New Issue
Block a user