1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-14 00:07:09 -05:00
v2fly/app/subscription/subscriptionmanager/subdocchecker.go
2023-11-26 10:55:27 +00:00

27 lines
602 B
Go

package subscriptionmanager
import "time"
func (s *SubscriptionManagerImpl) checkupSubscription(subscriptionName string) error {
var trackedSub *trackedSubscription
if trackedSubFound, found := s.trackedSubscriptions[subscriptionName]; !found {
return newError("not found")
} else {
trackedSub = trackedSubFound
}
shouldUpdate := false
if trackedSub.currentDocumentExpireTime.Before(time.Now()) {
shouldUpdate = true
}
if shouldUpdate {
if err := s.updateSubscription(subscriptionName); err != nil {
return newError("failed to update subscription: ", err)
}
}
return nil
}