Serverproxy manager (#61)

* Create serverproxy_manager.py

* Replace use of direct RenderServerProxy with ServerProxyManager method
This commit is contained in:
2023-11-05 01:00:36 -05:00
committed by GitHub
parent c3b446be8e
commit 0271abf705
3 changed files with 43 additions and 20 deletions

View File

@@ -0,0 +1,16 @@
from src.api.server_proxy import RenderServerProxy
class ServerProxyManager:
server_proxys = {}
@classmethod
def get_proxy_for_hostname(cls, hostname):
found_proxy = cls.server_proxys.get(hostname)
if not found_proxy:
new_proxy = RenderServerProxy(hostname)
new_proxy.start_background_update()
cls.server_proxys[hostname] = new_proxy
found_proxy = new_proxy
return found_proxy