From 1b836297bf3ab80aceee8ab9102e1704b759d6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Tue, 25 Jun 2024 01:52:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=9D=E8=AF=95=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/console/commands/panel_task.go | 6 ++++++ bootstrap/app.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/app/console/commands/panel_task.go b/app/console/commands/panel_task.go index a3efda82..60ac4200 100644 --- a/app/console/commands/panel_task.go +++ b/app/console/commands/panel_task.go @@ -2,6 +2,8 @@ package commands import ( "context" + "runtime" + "runtime/debug" "github.com/goravel/framework/contracts/console" "github.com/goravel/framework/contracts/console/command" @@ -68,6 +70,10 @@ func (receiver *PanelTask) Handle(console.Context) error { return err } + // 回收内存 + runtime.GC() + debug.FreeOSMemory() + types.Status = types.StatusNormal return nil } diff --git a/bootstrap/app.go b/bootstrap/app.go index c5e22b34..c2e6465f 100644 --- a/bootstrap/app.go +++ b/bootstrap/app.go @@ -1,6 +1,8 @@ package bootstrap import ( + "runtime/debug" + "github.com/gookit/validate/locales/zhcn" "github.com/goravel/framework/foundation" @@ -8,6 +10,8 @@ import ( ) func Boot() { + debug.SetGCPercent(20) + zhcn.RegisterGlobal() app := foundation.NewApplication()