mirror of
https://github.com/livekit/livekit.git
synced 2026-03-29 15:49:55 +00:00
Some misc clean up. (#3156)
* Some misc clean up. - Have been seeing counterfeiter warnings about efficiency for a while with go:generate declaration multiple times in the same package. Address that: https://github.com/maxbrunsfeld/counterfeiter?tab=readme-ov-file#step-2b---add-counterfeitergenerate-directives - A bit more readability on parameters passed to `sendLeave` * spacing * revert some deletes as the complaint was in analytics service only * Declare in package only once. Although the warning is about go:generate multiple times when directly giving the interface to generate, have `go:generate` multiple times in a package even with `-generate` ends up generating once per invocation. Once per package is enough to run the generation just once.
This commit is contained in:
@@ -24,8 +24,6 @@ import (
|
||||
"github.com/livekit/psrpc/pkg/middleware"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
||||
|
||||
//counterfeiter:generate . RoomManagerClient
|
||||
type RoomManagerClient interface {
|
||||
rpc.TypedRoomManagerClient
|
||||
|
||||
@@ -36,8 +36,6 @@ import (
|
||||
var ErrSignalWriteFailed = errors.New("signal write failed")
|
||||
var ErrSignalMessageDropped = errors.New("signal message dropped")
|
||||
|
||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
||||
|
||||
//counterfeiter:generate . SignalClient
|
||||
type SignalClient interface {
|
||||
ActiveCount() int
|
||||
|
||||
@@ -963,7 +963,12 @@ func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseRea
|
||||
p.clearMigrationTimer()
|
||||
|
||||
if sendLeave {
|
||||
p.sendLeaveRequest(reason, isExpectedToResume, false, false)
|
||||
p.sendLeaveRequest(
|
||||
reason,
|
||||
isExpectedToResume,
|
||||
false, // isExpectedToReconnect
|
||||
false, // sendOnlyIfSupportingLeaveRequestWithAction
|
||||
)
|
||||
}
|
||||
|
||||
if p.supervisor != nil {
|
||||
@@ -1070,7 +1075,12 @@ func (p *ParticipantImpl) MaybeStartMigration(force bool, onStart func()) bool {
|
||||
onStart()
|
||||
}
|
||||
|
||||
p.sendLeaveRequest(types.ParticipantCloseReasonMigrationRequested, true, false, true)
|
||||
p.sendLeaveRequest(
|
||||
types.ParticipantCloseReasonMigrationRequested,
|
||||
true, // isExpectedToResume
|
||||
false, // isExpectedToReconnect
|
||||
true, // sendOnlyIfSupportingLeaveRequestWithAction
|
||||
)
|
||||
p.CloseSignalConnection(types.SignallingCloseReasonMigration)
|
||||
|
||||
p.clearMigrationTimer()
|
||||
@@ -1818,8 +1828,14 @@ func (p *ParticipantImpl) setupDisconnectTimer() {
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) onAnyTransportFailed() {
|
||||
// clients support resuming of connections when websocket becomes disconnected
|
||||
p.sendLeaveRequest(types.ParticipantCloseReasonPeerConnectionDisconnected, true, false, true)
|
||||
p.sendLeaveRequest(
|
||||
types.ParticipantCloseReasonPeerConnectionDisconnected,
|
||||
true, // isExpectedToResume
|
||||
false, // isExpectedToReconnect
|
||||
true, // sendOnlyIfSupportingLeaveRequestWithAction
|
||||
)
|
||||
|
||||
// clients support resuming of connections when signalling becomes disconnected
|
||||
p.CloseSignalConnection(types.SignallingCloseReasonTransportFailure)
|
||||
|
||||
// detect when participant has actually left.
|
||||
@@ -2656,7 +2672,12 @@ func (p *ParticipantImpl) GetCachedDownTrack(trackID livekit.TrackID) (*webrtc.R
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) IssueFullReconnect(reason types.ParticipantCloseReason) {
|
||||
p.sendLeaveRequest(reason, false, true, false)
|
||||
p.sendLeaveRequest(
|
||||
reason,
|
||||
false, // isExpectedToResume
|
||||
true, // isExpectedToReconnect
|
||||
false, // sendOnlyIfSupportingLeaveRequestWithAction
|
||||
)
|
||||
|
||||
scr := types.SignallingCloseReasonUnknown
|
||||
switch reason {
|
||||
|
||||
@@ -27,8 +27,6 @@ import (
|
||||
"github.com/livekit/protocol/utils/guid"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
||||
|
||||
//counterfeiter:generate . IOClient
|
||||
type IOClient interface {
|
||||
CreateEgress(ctx context.Context, info *livekit.EgressInfo) (*emptypb.Empty, error)
|
||||
|
||||
@@ -31,8 +31,6 @@ import (
|
||||
"github.com/livekit/psrpc/pkg/middleware"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
||||
|
||||
//counterfeiter:generate . SessionHandler
|
||||
type SessionHandler interface {
|
||||
Logger(ctx context.Context) logger.Logger
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . AnalyticsService
|
||||
//counterfeiter:generate . AnalyticsService
|
||||
type AnalyticsService interface {
|
||||
SendStats(ctx context.Context, stats []*livekit.AnalyticsStat)
|
||||
SendEvent(ctx context.Context, events *livekit.AnalyticsEvent)
|
||||
|
||||
@@ -26,7 +26,9 @@ import (
|
||||
"github.com/livekit/protocol/webhook"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . TelemetryService
|
||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
||||
|
||||
//counterfeiter:generate . TelemetryService
|
||||
type TelemetryService interface {
|
||||
// TrackStats is called periodically for each track in both directions (published/subscribed)
|
||||
TrackStats(key StatsKey, stat *livekit.AnalyticsStat)
|
||||
|
||||
Reference in New Issue
Block a user