block: optimising for RKS large pattern list

This commit is contained in:
Iain Learmonth 2022-06-18 13:35:25 +01:00
parent 293d83cc1c
commit bbf070339a
2 changed files with 9 additions and 6 deletions

View file

@ -23,13 +23,16 @@ class BlockMirrorAutomation(BaseAutomation):
def automate(self, full: bool = False) -> Tuple[bool, str]:
self.fetch()
logging.debug("Fetch complete")
self.parse()
logging.debug("Parse complete")
rotated = list()
for pattern in self.patterns:
for proxy in active_proxies():
if proxy.url is None:
# Not ready yet
continue
for proxy in active_proxies():
if proxy.url is None:
# Not ready yet
continue
logging.debug("Testing active proxy %s", proxy.url)
for pattern in self.patterns:
if fnmatch(proxy.url, pattern):
logging.debug("Found %s blocked", proxy.url)
if not proxy.origin.auto_rotation: