mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-17 22:19:42 +02:00
fix: optimize memory usage, fix agent and code refactor (#118)
* refactor: simplify io code and make utils module independent * fix(docker): agent and socket-proxy docker event flushing with modified reverse proxy handler * refactor: remove unused code * refactor: remove the use of logging module in most code * refactor: streamline domain mismatch check in certState function * tweak: use ecdsa p-256 for autocert * fix(tests): update health check tests for invalid host and add case for port in host * feat(acme): custom acme directory * refactor: code refactor and improved context and error handling * tweak: optimize memory usage under load * fix(oidc): restore old user matching behavior * docs: add ChatGPT assistant to README --------- Co-authored-by: yusing <yusing@6uo.me>
This commit is contained in:
@@ -7,9 +7,9 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/yusing/go-proxy/internal/common"
|
||||
"github.com/yusing/go-proxy/internal/gperr"
|
||||
"github.com/yusing/go-proxy/internal/logging"
|
||||
"github.com/yusing/go-proxy/internal/utils/strutils"
|
||||
)
|
||||
|
||||
@@ -116,14 +116,14 @@ func (t *Task) Finish(reason any) {
|
||||
func (t *Task) finish(reason any) {
|
||||
t.cancel(fmtCause(reason))
|
||||
if !waitWithTimeout(t.childrenDone) {
|
||||
logging.Debug().
|
||||
log.Debug().
|
||||
Str("task", t.name).
|
||||
Strs("subtasks", t.listChildren()).
|
||||
Msg("Timeout waiting for subtasks to finish")
|
||||
}
|
||||
go t.runCallbacks()
|
||||
if !waitWithTimeout(t.callbacksDone) {
|
||||
logging.Debug().
|
||||
log.Debug().
|
||||
Str("task", t.name).
|
||||
Strs("callbacks", t.listCallbacks()).
|
||||
Msg("Timeout waiting for callbacks to finish")
|
||||
@@ -134,7 +134,7 @@ func (t *Task) finish(reason any) {
|
||||
}
|
||||
t.parent.subChildCount()
|
||||
allTasks.Remove(t)
|
||||
logging.Trace().Msg("task " + t.name + " finished")
|
||||
log.Trace().Msg("task " + t.name + " finished")
|
||||
}
|
||||
|
||||
// Subtask returns a new subtask with the given name, derived from the parent's context.
|
||||
@@ -166,7 +166,7 @@ func (t *Task) Subtask(name string, needFinish ...bool) *Task {
|
||||
}()
|
||||
}
|
||||
|
||||
logging.Trace().Msg("task " + child.name + " started")
|
||||
log.Trace().Msg("task " + child.name + " started")
|
||||
return child
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ func (t *Task) MarshalText() ([]byte, error) {
|
||||
func (t *Task) invokeWithRecover(fn func(), caller string) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
logging.Error().
|
||||
log.Error().
|
||||
Interface("err", err).
|
||||
Msg("panic in task " + t.name + "." + caller)
|
||||
if common.IsDebug {
|
||||
|
||||
Reference in New Issue
Block a user