Skip to content

Commit 282890e

Browse files
authored
fix: fx.Invoke for smr.Run not wrapped in Goroutine properly (#129)
1 parent 6c90e08 commit 282890e

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ jobs:
113113
- name: golangci-lint
114114
uses: golangci/[email protected]
115115
with:
116-
timeout: 10m
116+
# Optional: golangci-lint command line arguments.
117+
args: '--timeout=10m'
117118

118119
unittest:
119120
name: Unit Test

.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ linters:
1111

1212
# - bodyclose # due to https://github.com/golangci/golangci-lint/issues/3086#issuecomment-1475232706
1313
- containedctx
14-
- depguard
1514
- dupl
1615
- durationcheck
1716
- errname
@@ -40,6 +39,8 @@ linters:
4039
- usestdlibvars
4140
- whitespace
4241
- wsl
42+
disable:
43+
- depguard
4344

4445
linters-settings:
4546
wsl:

cmd/insights-bot/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"context"
5-
"github.com/nekomeowww/insights-bot/internal/services/smr"
65
"log"
76
"time"
87

@@ -19,6 +18,7 @@ import (
1918
"github.com/nekomeowww/insights-bot/internal/services/autorecap"
2019
"github.com/nekomeowww/insights-bot/internal/services/health"
2120
"github.com/nekomeowww/insights-bot/internal/services/pprof"
21+
"github.com/nekomeowww/insights-bot/internal/services/smr"
2222
"github.com/nekomeowww/insights-bot/internal/thirdparty"
2323
)
2424

internal/services/health/health.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ package health
33
import (
44
"context"
55
"fmt"
6-
"github.com/nekomeowww/insights-bot/internal/services/smr"
7-
"github.com/nekomeowww/insights-bot/pkg/bots/discordbot"
8-
"github.com/nekomeowww/insights-bot/pkg/bots/slackbot"
96
"net"
107
"net/http"
118
"time"
@@ -15,6 +12,9 @@ import (
1512

1613
"github.com/nekomeowww/insights-bot/internal/services/autorecap"
1714
"github.com/nekomeowww/insights-bot/internal/services/pprof"
15+
"github.com/nekomeowww/insights-bot/internal/services/smr"
16+
"github.com/nekomeowww/insights-bot/pkg/bots/discordbot"
17+
"github.com/nekomeowww/insights-bot/pkg/bots/slackbot"
1818
"github.com/nekomeowww/insights-bot/pkg/bots/tgbot"
1919
"github.com/nekomeowww/insights-bot/pkg/logger"
2020
)

internal/services/smr/smr.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package smr
33
import (
44
"context"
55
"errors"
6+
"time"
7+
68
"github.com/nekomeowww/insights-bot/internal/configs"
79
"github.com/nekomeowww/insights-bot/internal/datastore"
810
"github.com/nekomeowww/insights-bot/internal/models/smr"
@@ -14,7 +16,6 @@ import (
1416
"github.com/redis/rueidis"
1517
"github.com/samber/lo"
1618
"go.uber.org/fx"
17-
"time"
1819
)
1920

2021
func NewModules() fx.Option {
@@ -151,9 +152,8 @@ func (s *Service) stop() {
151152
s.closeFunc()
152153
}
153154

154-
func Run() func(s *Service) error {
155-
return func(s *Service) error {
156-
s.run()
157-
return nil
155+
func Run() func(s *Service) {
156+
return func(s *Service) {
157+
go s.run()
158158
}
159159
}

0 commit comments

Comments
 (0)