refactor(server): 适配变量系统重命名

适配 variable.NewContext/ReleaseContext 重命名

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-04-10 09:40:47 +08:00
parent 4c12703334
commit 7950f17da5
4 changed files with 7 additions and 7 deletions

View File

@ -274,7 +274,7 @@ type PoolStats struct {
func (p *GoroutinePool) WrapHandler(handler fasthttp.RequestHandler) fasthttp.RequestHandler { func (p *GoroutinePool) WrapHandler(handler fasthttp.RequestHandler) fasthttp.RequestHandler {
return func(ctx *fasthttp.RequestCtx) { return func(ctx *fasthttp.RequestCtx) {
// 使用池执行处理器 // 使用池执行处理器
_ = p.Submit(ctx, func(innerCtx *fasthttp.RequestCtx) { _ = p.Submit(ctx, func(_ *fasthttp.RequestCtx) {
handler(ctx) handler(ctx)
}) })
} }

View File

@ -83,7 +83,7 @@ func TestPoolSubmit(t *testing.T) {
defer p.Stop() defer p.Stop()
var executed atomic.Bool var executed atomic.Bool
task := func(ctx *fasthttp.RequestCtx) { task := func(*fasthttp.RequestCtx) {
executed.Store(true) executed.Store(true)
} }
@ -142,7 +142,7 @@ func TestPoolConcurrentSubmit(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
_ = p.Submit(nil, func(ctx *fasthttp.RequestCtx) { _ = p.Submit(nil, func(_ *fasthttp.RequestCtx) {
counter.Add(1) counter.Add(1)
}) })
}() }()
@ -165,7 +165,7 @@ func TestPoolSubmitWhenStopped(t *testing.T) {
// 不启动池 // 不启动池
var executed atomic.Bool var executed atomic.Bool
task := func(ctx *fasthttp.RequestCtx) { task := func(_ *fasthttp.RequestCtx) {
executed.Store(true) executed.Store(true)
} }
@ -219,7 +219,7 @@ func TestPoolWrapHandler_WhenStopped(t *testing.T) {
// 不启动池 // 不启动池
var executed atomic.Bool var executed atomic.Bool
originalHandler := func(ctx *fasthttp.RequestCtx) { originalHandler := func(*fasthttp.RequestCtx) {
executed.Store(true) executed.Store(true)
} }

View File

@ -296,7 +296,7 @@ func (s *Server) buildMiddlewareChain(serverCfg *config.ServerConfig) (*middlewa
serverCfg.Security.Headers.ContentSecurityPolicy != "" || serverCfg.Security.Headers.ContentSecurityPolicy != "" ||
serverCfg.Security.Headers.ReferrerPolicy != "" || serverCfg.Security.Headers.ReferrerPolicy != "" ||
serverCfg.Security.Headers.PermissionsPolicy != "" { 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) middlewares = append(middlewares, headers)
} }

View File

@ -618,7 +618,7 @@ func TestServer_TrackStats_EmptyBody(t *testing.T) {
s := New(cfg) s := New(cfg)
handler := func(ctx *fasthttp.RequestCtx) { handler := func(_ *fasthttp.RequestCtx) {
// 空响应 // 空响应
} }