Crash zurg on user info initial request
This commit is contained in:
@@ -14,14 +14,13 @@ 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()
|
||||||
|
if err != nil {
|
||||||
|
zurglog.Fatalf("Failed to get user information: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
workerPool.Submit(func() {
|
workerPool.Submit(func() {
|
||||||
for {
|
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 {
|
if userInfo.Premium <= MINIMUM_SLEEP {
|
||||||
zurglog.Fatal("Your account is no longer premium, exiting...")
|
zurglog.Fatal("Your account is no longer premium, exiting...")
|
||||||
} else {
|
} else {
|
||||||
@@ -41,6 +40,14 @@ func MonitorPremiumStatus(workerPool *ants.Pool, rd *realdebrid.RealDebrid, zurg
|
|||||||
}
|
}
|
||||||
sleepDuration := time.Duration(remaining) * time.Second
|
sleepDuration := time.Duration(remaining) * time.Second
|
||||||
time.Sleep(sleepDuration)
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user