From e76ea98f65701725f31864ff6c731c4a2063889f Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 29 Aug 2021 10:21:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0TeaGo=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E5=8D=87SQL=E8=A7=A3=E6=9E=90=E6=95=88=E7=8E=87=E3=80=81?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=BC=80=E5=90=AFSQL=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 3 +-- go.sum | 2 ++ internal/db/models/server_dao_test.go | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 445cc6a6..ea03cdf5 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.15 replace github.com/TeaOSLab/EdgeCommon => ../EdgeCommon - require ( github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/TeaOSLab/EdgeCommon v0.0.0-00010101000000-000000000000 @@ -16,7 +15,7 @@ require ( github.com/go-sql-driver/mysql v1.5.0 github.com/go-yaml/yaml v2.1.0+incompatible github.com/golang/protobuf v1.5.2 - github.com/iwind/TeaGo v0.0.0-20210824034952-1a56ad7d0b5e + github.com/iwind/TeaGo v0.0.0-20210829020150-9c36d31301a5 github.com/iwind/gosock v0.0.0-20210722083328-12b2d66abec3 github.com/json-iterator/go v1.1.11 // indirect github.com/lionsoul2014/ip2region v2.2.0-release+incompatible diff --git a/go.sum b/go.sum index 480af9f0..2114cc61 100644 --- a/go.sum +++ b/go.sum @@ -188,6 +188,8 @@ github.com/iwind/TeaGo v0.0.0-20210809112119-a57ed0e84e34 h1:ZCNQXLiGF5Z1cV3Pi03 github.com/iwind/TeaGo v0.0.0-20210809112119-a57ed0e84e34/go.mod h1:KU4mS7QNiZ7QWEuDBk1zw0/Q2LrAPZv3tycEFBsuUwc= github.com/iwind/TeaGo v0.0.0-20210824034952-1a56ad7d0b5e h1:GDCU57lQD6W9u5KT2834MmK022FSeAbskb7H0p2eaJY= github.com/iwind/TeaGo v0.0.0-20210824034952-1a56ad7d0b5e/go.mod h1:KU4mS7QNiZ7QWEuDBk1zw0/Q2LrAPZv3tycEFBsuUwc= +github.com/iwind/TeaGo v0.0.0-20210829020150-9c36d31301a5 h1:ybjIXGT3E/ZbfkRhIb903WMfLyt2Uv5p4niAqi8jwvM= +github.com/iwind/TeaGo v0.0.0-20210829020150-9c36d31301a5/go.mod h1:KU4mS7QNiZ7QWEuDBk1zw0/Q2LrAPZv3tycEFBsuUwc= github.com/iwind/gosock v0.0.0-20210722083328-12b2d66abec3 h1:aBSonas7vFcgTj9u96/bWGILGv1ZbUSTLiOzcI1ZT6c= github.com/iwind/gosock v0.0.0-20210722083328-12b2d66abec3/go.mod h1:H5Q7SXwbx3a97ecJkaS2sD77gspzE7HFUafBO0peEyA= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/internal/db/models/server_dao_test.go b/internal/db/models/server_dao_test.go index 3a8c3d7a..232847b4 100644 --- a/internal/db/models/server_dao_test.go +++ b/internal/db/models/server_dao_test.go @@ -144,3 +144,15 @@ func TestServerDAO_FindAllEnabledServersWithNode(t *testing.T) { t.Log("serverId:", server.Id, "clusterId:", server.ClusterId) } } + +func BenchmarkServerDAO_CountAllEnabledServers(b *testing.B) { + SharedServerDAO = NewServerDAO() + + for i := 0; i < b.N; i++ { + result, err := SharedServerDAO.CountAllEnabledServers(nil) + if err != nil { + b.Fatal(err) + } + _ = result + } +}