Skip to content

Commit f2a2831

Browse files
committed
feat: refactor supervisor
1 parent a1f0331 commit f2a2831

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2362
-1026
lines changed

cmd/admin_wire.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ import (
1414
"github.com/tuihub/librarian/internal/lib/libapp"
1515
"github.com/tuihub/librarian/internal/lib/libauth"
1616
"github.com/tuihub/librarian/internal/lib/libcache"
17-
"github.com/tuihub/librarian/internal/lib/libcron"
1817
"github.com/tuihub/librarian/internal/lib/libidgenerator"
19-
"github.com/tuihub/librarian/internal/lib/libmq"
20-
"github.com/tuihub/librarian/internal/lib/libobserve"
2118
"github.com/tuihub/librarian/internal/lib/libsearch"
22-
"github.com/tuihub/librarian/internal/service/supervisor"
2319
)
2420

2521
func wireAdmin(
@@ -33,12 +29,8 @@ func wireAdmin(
3329
data.ProviderSet,
3430
biz.ProviderSet,
3531
client.ProviderSet,
36-
supervisor.ProviderSet,
3732
libauth.ProviderSet,
38-
libmq.ProviderSet,
39-
libcron.ProviderSet,
4033
libcache.ProviderSet,
41-
libobserve.ProviderSet,
4234
libidgenerator.ProviderSet,
4335
libsearch.ProviderSet,
4436
),

cmd/serve.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/tuihub/librarian/internal/lib/libs3"
1212
"github.com/tuihub/librarian/internal/lib/libzap"
1313
"github.com/tuihub/librarian/internal/service/angelaweb"
14+
"github.com/tuihub/librarian/internal/service/supervisor"
1415

1516
"github.com/go-kratos/kratos/v2"
1617
"github.com/go-kratos/kratos/v2/transport"
@@ -56,6 +57,7 @@ func newApp(
5657
gs *grpc.Server,
5758
hs *http.Server,
5859
aw *angelaweb.AngelaWeb,
60+
sv *supervisor.SupervisorService,
5961
mq *libmq.MQ,
6062
cron *libcron.Cron,
6163
obs *libobserve.BuiltInObserver,
@@ -69,7 +71,7 @@ func newApp(
6971
kratos.Version(version),
7072
kratos.Metadata(map[string]string{}),
7173
kratos.Server(append([]transport.Server{
72-
gs, hs, aw, mq, cron, obs, s3,
74+
gs, hs, aw, sv, mq, cron, obs, s3,
7375
}, inprocPorter.Servers...)...),
7476
}
7577
r, err := libdiscovery.NewRegistrar(consul)

cmd/wire_gen.go

Lines changed: 67 additions & 106 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ require (
4242
github.com/muzhou233/go-favicon v0.1.1
4343
github.com/nicksnyder/go-i18n/v2 v2.6.0
4444
github.com/nikoksr/notify v1.3.0
45+
github.com/panjf2000/ants/v2 v2.11.3
4546
github.com/redis/go-redis/v9 v9.11.0
4647
github.com/samber/lo v1.51.0
4748
github.com/sony/sonyflake v1.2.1
@@ -221,7 +222,7 @@ require (
221222
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
222223
golang.org/x/mod v0.25.0 // indirect
223224
golang.org/x/net v0.41.0 // indirect
224-
golang.org/x/sync v0.15.0 // indirect
225+
golang.org/x/sync v0.16.0 // indirect
225226
golang.org/x/sys v0.33.0 // indirect
226227
golang.org/x/tools v0.33.0 // indirect
227228
google.golang.org/appengine v1.6.8 // indirect

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
617617
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
618618
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
619619
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
620+
github.com/panjf2000/ants/v2 v2.11.3 h1:AfI0ngBoXJmYOpDh9m516vjqoUu2sLrIVgppI9TZVpg=
621+
github.com/panjf2000/ants/v2 v2.11.3/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
620622
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
621623
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
622624
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
@@ -947,8 +949,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
947949
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
948950
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
949951
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
950-
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
951-
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
952+
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
953+
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
952954
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
953955
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
954956
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

internal/biz/biz.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/tuihub/librarian/internal/biz/bizgebura"
88
"github.com/tuihub/librarian/internal/biz/bizkether"
99
"github.com/tuihub/librarian/internal/biz/biznetzach"
10+
"github.com/tuihub/librarian/internal/biz/bizsupervisor"
1011
"github.com/tuihub/librarian/internal/biz/biztiphereth"
1112
"github.com/tuihub/librarian/internal/biz/bizyesod"
1213

@@ -23,4 +24,5 @@ var ProviderSet = wire.NewSet(
2324
bizyesod.ProviderSet,
2425
biznetzach.ProviderSet,
2526
bizchesed.ProviderSet,
27+
bizsupervisor.ProviderSet,
2628
)

0 commit comments

Comments
 (0)