|
|
@ -105,10 +105,12 @@ class SZProviderPool(ProviderPool):
|
|
|
|
# Check if the pool was initialized enough hours ago
|
|
|
|
# Check if the pool was initialized enough hours ago
|
|
|
|
self._check_lifetime()
|
|
|
|
self._check_lifetime()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
providers = set(providers or [])
|
|
|
|
|
|
|
|
|
|
|
|
# Check if any new provider has been added
|
|
|
|
# Check if any new provider has been added
|
|
|
|
updated = set(providers) != self.providers or ban_list != self.ban_list
|
|
|
|
updated = providers != self.providers or ban_list != self.ban_list
|
|
|
|
removed_providers = list(sorted(self.providers - set(providers)))
|
|
|
|
removed_providers = list(sorted(self.providers - providers))
|
|
|
|
new_providers = list(sorted(set(providers) - self.providers))
|
|
|
|
new_providers = list(sorted(providers - self.providers))
|
|
|
|
|
|
|
|
|
|
|
|
# Terminate and delete removed providers from instance
|
|
|
|
# Terminate and delete removed providers from instance
|
|
|
|
for removed in removed_providers:
|
|
|
|
for removed in removed_providers:
|
|
|
@ -128,8 +130,6 @@ class SZProviderPool(ProviderPool):
|
|
|
|
self.providers.difference_update(removed_providers)
|
|
|
|
self.providers.difference_update(removed_providers)
|
|
|
|
self.providers.update(list(providers))
|
|
|
|
self.providers.update(list(providers))
|
|
|
|
|
|
|
|
|
|
|
|
self.blacklist = blacklist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Restart providers with new configs
|
|
|
|
# Restart providers with new configs
|
|
|
|
for key, val in provider_configs.items():
|
|
|
|
for key, val in provider_configs.items():
|
|
|
|
# Don't restart providers that are not enabled
|
|
|
|
# Don't restart providers that are not enabled
|
|
|
@ -154,6 +154,9 @@ class SZProviderPool(ProviderPool):
|
|
|
|
|
|
|
|
|
|
|
|
self.provider_configs = provider_configs
|
|
|
|
self.provider_configs = provider_configs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.blacklist = blacklist or []
|
|
|
|
|
|
|
|
self.ban_list = ban_list or {'must_contain': [], 'must_not_contain': []}
|
|
|
|
|
|
|
|
|
|
|
|
return updated
|
|
|
|
return updated
|
|
|
|
|
|
|
|
|
|
|
|
def _check_lifetime(self):
|
|
|
|
def _check_lifetime(self):
|
|
|
|