Fixed a few issues:

- Incorrect name being shown on dashboard "Proxies page"
- Apps being shown when homepage.show is false
- Load balanced routes are shown on homepage instead of the load balancer
- Route with idlewatcher will now be removed on container destroy
- Idlewatcher panic
- Performance improvement
- Idlewatcher infinitely loading
- Reload stucked / not working properly
- Streams stuck on shutdown / reload
- etc...
Added:
- support idlewatcher for loadbalanced routes
- partial implementation for stream type idlewatcher
Issues:
- graceful shutdown
This commit is contained in:
yusing
2024-10-18 16:47:01 +08:00
parent c0c61709ca
commit 53557e38b6
69 changed files with 2368 additions and 1654 deletions

View File

@@ -17,35 +17,36 @@ type builder struct {
}
func NewBuilder(format string, args ...any) Builder {
return Builder{&builder{message: fmt.Sprintf(format, args...)}}
if len(args) > 0 {
return Builder{&builder{message: fmt.Sprintf(format, args...)}}
}
return Builder{&builder{message: format}}
}
// adding nil / nil is no-op,
// you may safely pass expressions returning error to it.
func (b Builder) Add(err NestedError) Builder {
func (b Builder) Add(err NestedError) {
if err != nil {
b.Lock()
b.errors = append(b.errors, err)
b.Unlock()
}
return b
}
func (b Builder) AddE(err error) Builder {
return b.Add(From(err))
func (b Builder) AddE(err error) {
b.Add(From(err))
}
func (b Builder) Addf(format string, args ...any) Builder {
return b.Add(errorf(format, args...))
func (b Builder) Addf(format string, args ...any) {
b.Add(errorf(format, args...))
}
func (b Builder) AddRangeE(errs ...error) Builder {
func (b Builder) AddRangeE(errs ...error) {
b.Lock()
defer b.Unlock()
for _, err := range errs {
b.AddE(err)
}
return b
}
// Build builds a NestedError based on the errors collected in the Builder.

View File

@@ -2,6 +2,7 @@ package error
import (
stderrors "errors"
"fmt"
"reflect"
)
@@ -16,6 +17,7 @@ var (
ErrOutOfRange = stderrors.New("out of range")
ErrTypeError = stderrors.New("type error")
ErrTypeMismatch = stderrors.New("type mismatch")
ErrPanicRecv = stderrors.New("panic")
)
const fmtSubjectWhat = "%w %v: %q"
@@ -75,3 +77,7 @@ func TypeError2(subject any, from, to reflect.Value) NestedError {
func TypeMismatch[Expect any](value any) NestedError {
return errorf("%w: expect %s got %T", ErrTypeMismatch, reflect.TypeFor[Expect](), value)
}
func PanicRecv(format string, args ...any) NestedError {
return errorf("%w%s", ErrPanicRecv, fmt.Sprintf(format, args...))
}