mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 00:54:23 +00:00
Implement caching for remote instance proxies and enhance proxy request handling
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"llamactl/pkg/config"
|
||||
"llamactl/pkg/manager"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -11,6 +13,8 @@ type Handler struct {
|
||||
InstanceManager manager.InstanceManager
|
||||
cfg config.AppConfig
|
||||
httpClient *http.Client
|
||||
remoteProxies map[string]*httputil.ReverseProxy // Cache of remote proxies by instance name
|
||||
remoteProxiesMu sync.RWMutex
|
||||
}
|
||||
|
||||
func NewHandler(im manager.InstanceManager, cfg config.AppConfig) *Handler {
|
||||
@@ -20,5 +24,6 @@ func NewHandler(im manager.InstanceManager, cfg config.AppConfig) *Handler {
|
||||
httpClient: &http.Client{
|
||||
Timeout: 30 * time.Second,
|
||||
},
|
||||
remoteProxies: make(map[string]*httputil.ReverseProxy),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user