Crash zurg on user info initial request

This commit is contained in:
Ben Adrian Sarmiento
2024-06-20 14:45:21 +02:00
parent 340735f833
commit 10fa7774f4

View File

@@ -14,14 +14,13 @@ const (
)
func MonitorPremiumStatus(workerPool *ants.Pool, rd *realdebrid.RealDebrid, zurglog *logutil.Logger) {
userInfo, err := rd.GetUserInformation()
if err != nil {
zurglog.Fatalf("Failed to get user information: %v", err)
}
workerPool.Submit(func() {
for {
userInfo, err := rd.GetUserInformation()
if err != nil {
zurglog.Errorf("Failed to get user information: %v", err)
time.Sleep(5 * time.Minute)
continue
}
if userInfo.Premium <= MINIMUM_SLEEP {
zurglog.Fatal("Your account is no longer premium, exiting...")
} else {
@@ -41,6 +40,14 @@ func MonitorPremiumStatus(workerPool *ants.Pool, rd *realdebrid.RealDebrid, zurg
}
sleepDuration := time.Duration(remaining) * time.Second
time.Sleep(sleepDuration)
// fetch user information again
userInfo, err = rd.GetUserInformation()
if err != nil {
zurglog.Errorf("Failed to get user information: %v", err)
time.Sleep(5 * time.Minute)
continue
}
}
})
}