Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixbug: fix occasional RPC blocking issue due to coroutine scheduling… #505

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions tars/statf.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,21 @@ type StatFHelper struct {
mStatCountFromServer map[statf.StatMicMsgHead]int
}

func newStatFHelper(app *application) *StatFHelper {
return &StatFHelper{
chStatInfo: make(chan StatInfo, app.ServerConfig().StatReportChannelBufLen),
mStatInfo: make(map[statf.StatMicMsgHead]statf.StatMicMsgBody),
mStatCount: make(map[statf.StatMicMsgHead]int),
app: app,
chStatInfoFromServer: make(chan StatInfo, app.ServerConfig().StatReportChannelBufLen),
mStatInfoFromServer: make(map[statf.StatMicMsgHead]statf.StatMicMsgBody),
mStatCountFromServer: make(map[statf.StatMicMsgHead]int),
}
}

// Init the StatFHelper
func (s *StatFHelper) Init(comm *Communicator, servant string) {
s.servant = servant
s.app = comm.app
s.chStatInfo = make(chan StatInfo, s.app.ServerConfig().StatReportChannelBufLen)
s.chStatInfoFromServer = make(chan StatInfo, s.app.ServerConfig().StatReportChannelBufLen)
s.mStatInfo = make(map[statf.StatMicMsgHead]statf.StatMicMsgBody)
s.mStatCount = make(map[statf.StatMicMsgHead]int)
s.mStatInfoFromServer = make(map[statf.StatMicMsgHead]statf.StatMicMsgBody)
s.mStatCountFromServer = make(map[statf.StatMicMsgHead]int)
s.comm = comm
s.sf = new(statf.StatF)
s.comm.StringToProxy(s.servant, s.sf)
Expand Down Expand Up @@ -175,7 +180,7 @@ func initReport(app *application) error {
return fmt.Errorf("stat init error")
}
comm := app.Communicator()
StatReport = new(StatFHelper)
StatReport = newStatFHelper(app)
StatReport.Init(comm, cfg.Stat)
statInited <- struct{}{}
go StatReport.Run()
Expand Down
Loading