feat: enhance idlewaker loading page design and add favicon handling in waker_http, removed unnecessary checkings

This commit is contained in:
yusing
2025-03-29 08:18:58 +08:00
parent 1c001ed9df
commit d105f866ff
8 changed files with 201 additions and 132 deletions

View File

@@ -37,12 +37,14 @@ var (
clientMapMu sync.RWMutex
)
var initClientCleanerOnce sync.Once
const (
cleanInterval = 10 * time.Second
clientTTLSecs = int64(10)
)
func init() {
func initClientCleaner() {
cleaner := task.RootTask("docker_clients_cleaner")
go func() {
ticker := time.NewTicker(cleanInterval)
@@ -115,6 +117,8 @@ func (c *SharedClient) Close() {
// - Client: the Docker client connection.
// - error: an error if the connection failed.
func NewClient(host string) (*SharedClient, error) {
initClientCleanerOnce.Do(initClientCleaner)
clientMapMu.Lock()
defer clientMapMu.Unlock()