Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
eric2788 committed Apr 28, 2022
1 parent 71f80c3 commit 1c5a3b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion services/blive/live_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func coolDownLiveFetch(room int64) {

func LaunchLiveServer(wg *sync.WaitGroup, room int64, handle func(data *LiveInfo, msg biligo.Msg), cancelGet func(context.CancelFunc)) {

defer wg.Done()

log.Debugf("[%v] 正在獲取直播資訊...", room)

liveInfo, err := GetLiveInfo(room) // 獲取直播資訊
Expand Down Expand Up @@ -151,7 +153,6 @@ func LaunchLiveServer(wg *sync.WaitGroup, room int64, handle func(data *LiveInfo
}

cancelGet(stop)
wg.Done()
}

func shortDur(d time.Duration) string {
Expand Down
3 changes: 3 additions & 0 deletions services/blive/live_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
live "github.com/eric2788/biligo-live"
"github.com/eric2788/biligo-live-ws/services/database"
"github.com/go-playground/assert/v2"
"github.com/sirupsen/logrus"
"sync"
"testing"
"time"
Expand All @@ -26,6 +27,7 @@ func TestLaunchLiveServer(t *testing.T) {

var cancel context.CancelFunc
wg := &sync.WaitGroup{}
wg.Add(1)

go LaunchLiveServer(wg, 24643640, func(data *LiveInfo, msg live.Msg) {
t.Log(data, msg)
Expand All @@ -44,5 +46,6 @@ func TestLaunchLiveServer(t *testing.T) {
}

func init() {
logrus.SetLevel(logrus.DebugLevel)
_ = database.StartDB()
}

0 comments on commit 1c5a3b5

Please sign in to comment.