mirror of
https://github.com/blw1138/Zordon.git
synced 2026-02-05 21:56:10 +00:00
Serverproxy manager (#61)
* Create serverproxy_manager.py * Replace use of direct RenderServerProxy with ServerProxyManager method
This commit is contained in:
16
src/api/serverproxy_manager.py
Normal file
16
src/api/serverproxy_manager.py
Normal 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
|
||||
Reference in New Issue
Block a user