refactor(server): 适配变量系统重命名
适配 variable.NewContext/ReleaseContext 重命名 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4c12703334
commit
7950f17da5
@ -274,7 +274,7 @@ type PoolStats struct {
|
||||
func (p *GoroutinePool) WrapHandler(handler fasthttp.RequestHandler) fasthttp.RequestHandler {
|
||||
return func(ctx *fasthttp.RequestCtx) {
|
||||
// 使用池执行处理器
|
||||
_ = p.Submit(ctx, func(innerCtx *fasthttp.RequestCtx) {
|
||||
_ = p.Submit(ctx, func(_ *fasthttp.RequestCtx) {
|
||||
handler(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ func TestPoolSubmit(t *testing.T) {
|
||||
defer p.Stop()
|
||||
|
||||
var executed atomic.Bool
|
||||
task := func(ctx *fasthttp.RequestCtx) {
|
||||
task := func(*fasthttp.RequestCtx) {
|
||||
executed.Store(true)
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ func TestPoolConcurrentSubmit(t *testing.T) {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
_ = p.Submit(nil, func(ctx *fasthttp.RequestCtx) {
|
||||
_ = p.Submit(nil, func(_ *fasthttp.RequestCtx) {
|
||||
counter.Add(1)
|
||||
})
|
||||
}()
|
||||
@ -165,7 +165,7 @@ func TestPoolSubmitWhenStopped(t *testing.T) {
|
||||
|
||||
// 不启动池
|
||||
var executed atomic.Bool
|
||||
task := func(ctx *fasthttp.RequestCtx) {
|
||||
task := func(_ *fasthttp.RequestCtx) {
|
||||
executed.Store(true)
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ func TestPoolWrapHandler_WhenStopped(t *testing.T) {
|
||||
// 不启动池
|
||||
|
||||
var executed atomic.Bool
|
||||
originalHandler := func(ctx *fasthttp.RequestCtx) {
|
||||
originalHandler := func(*fasthttp.RequestCtx) {
|
||||
executed.Store(true)
|
||||
}
|
||||
|
||||
|
||||
@ -296,7 +296,7 @@ func (s *Server) buildMiddlewareChain(serverCfg *config.ServerConfig) (*middlewa
|
||||
serverCfg.Security.Headers.ContentSecurityPolicy != "" ||
|
||||
serverCfg.Security.Headers.ReferrerPolicy != "" ||
|
||||
serverCfg.Security.Headers.PermissionsPolicy != "" {
|
||||
headers := security.NewSecurityHeadersWithHSTS(&serverCfg.Security.Headers, &serverCfg.SSL.HSTS)
|
||||
headers := security.NewHeadersWithHSTS(&serverCfg.Security.Headers, &serverCfg.SSL.HSTS)
|
||||
middlewares = append(middlewares, headers)
|
||||
}
|
||||
|
||||
|
||||
@ -618,7 +618,7 @@ func TestServer_TrackStats_EmptyBody(t *testing.T) {
|
||||
|
||||
s := New(cfg)
|
||||
|
||||
handler := func(ctx *fasthttp.RequestCtx) {
|
||||
handler := func(_ *fasthttp.RequestCtx) {
|
||||
// 空响应
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user