chore: fix lint issues and improve formatting

This commit is contained in:
ExplodingDragon
2026-02-01 01:27:50 +08:00
parent df15e4a168
commit 51ec7972a4
2 changed files with 9 additions and 4 deletions

View File

@@ -133,9 +133,14 @@ func FilterInstGoJa(gl core.Params) (core.FilterInstance, error) {
} }
if result != nil { if result != nil {
if _, ok := result.Export().(*goja.Promise); ok { if _, ok := result.Export().(*goja.Promise); ok {
vm.Set("__internal_resolve", func(goja.Value) { stop <- nil }) if err := errors.Join(
vm.Set("__internal_reject", func(reason goja.Value) { stop <- errors.New(reason.String()) }) vm.Set("__internal_resolve", func(goja.Value) { stop <- nil }),
vm.Set("__internal_promise", result) vm.Set("__internal_reject", func(reason goja.Value) { stop <- errors.New(reason.String()) }),
vm.Set("__internal_promise", result),
); err != nil {
stop <- err
return
}
_, err := vm.RunString(`__internal_promise.then(__internal_resolve).catch(__internal_reject)`) _, err := vm.RunString(`__internal_promise.then(__internal_resolve).catch(__internal_reject)`)
if err != nil { if err != nil {
stop <- err stop <- err

View File

@@ -67,7 +67,7 @@ func WithEvent(event subscribe.Subscriber) ServerOption {
} }
} }
func WithMetaCache(cache kv.KV, ttl time.Duration, refresh time.Duration, refreshConcurrent int) ServerOption { func WithMetaCache(cache kv.KV, ttl, refresh time.Duration, refreshConcurrent int) ServerOption {
return func(c *serverConfig) { return func(c *serverConfig) {
c.cacheMeta = cache c.cacheMeta = cache
c.cacheMetaTTL = ttl c.cacheMetaTTL = ttl