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"
|
"github.com/livekit/psrpc/pkg/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
|
||||||
|
|
||||||
//counterfeiter:generate . RoomManagerClient
|
//counterfeiter:generate . RoomManagerClient
|
||||||
type RoomManagerClient interface {
|
type RoomManagerClient interface {
|
||||||
rpc.TypedRoomManagerClient
|
rpc.TypedRoomManagerClient
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ import (
|
|||||||
var ErrSignalWriteFailed = errors.New("signal write failed")
|
var ErrSignalWriteFailed = errors.New("signal write failed")
|
||||||
var ErrSignalMessageDropped = errors.New("signal message dropped")
|
var ErrSignalMessageDropped = errors.New("signal message dropped")
|
||||||
|
|
||||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
|
||||||
|
|
||||||
//counterfeiter:generate . SignalClient
|
//counterfeiter:generate . SignalClient
|
||||||
type SignalClient interface {
|
type SignalClient interface {
|
||||||
ActiveCount() int
|
ActiveCount() int
|
||||||
|
|||||||
+26
-5
@@ -963,7 +963,12 @@ func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseRea
|
|||||||
p.clearMigrationTimer()
|
p.clearMigrationTimer()
|
||||||
|
|
||||||
if sendLeave {
|
if sendLeave {
|
||||||
p.sendLeaveRequest(reason, isExpectedToResume, false, false)
|
p.sendLeaveRequest(
|
||||||
|
reason,
|
||||||
|
isExpectedToResume,
|
||||||
|
false, // isExpectedToReconnect
|
||||||
|
false, // sendOnlyIfSupportingLeaveRequestWithAction
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.supervisor != nil {
|
if p.supervisor != nil {
|
||||||
@@ -1070,7 +1075,12 @@ func (p *ParticipantImpl) MaybeStartMigration(force bool, onStart func()) bool {
|
|||||||
onStart()
|
onStart()
|
||||||
}
|
}
|
||||||
|
|
||||||
p.sendLeaveRequest(types.ParticipantCloseReasonMigrationRequested, true, false, true)
|
p.sendLeaveRequest(
|
||||||
|
types.ParticipantCloseReasonMigrationRequested,
|
||||||
|
true, // isExpectedToResume
|
||||||
|
false, // isExpectedToReconnect
|
||||||
|
true, // sendOnlyIfSupportingLeaveRequestWithAction
|
||||||
|
)
|
||||||
p.CloseSignalConnection(types.SignallingCloseReasonMigration)
|
p.CloseSignalConnection(types.SignallingCloseReasonMigration)
|
||||||
|
|
||||||
p.clearMigrationTimer()
|
p.clearMigrationTimer()
|
||||||
@@ -1818,8 +1828,14 @@ func (p *ParticipantImpl) setupDisconnectTimer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *ParticipantImpl) onAnyTransportFailed() {
|
func (p *ParticipantImpl) onAnyTransportFailed() {
|
||||||
// clients support resuming of connections when websocket becomes disconnected
|
p.sendLeaveRequest(
|
||||||
p.sendLeaveRequest(types.ParticipantCloseReasonPeerConnectionDisconnected, true, false, true)
|
types.ParticipantCloseReasonPeerConnectionDisconnected,
|
||||||
|
true, // isExpectedToResume
|
||||||
|
false, // isExpectedToReconnect
|
||||||
|
true, // sendOnlyIfSupportingLeaveRequestWithAction
|
||||||
|
)
|
||||||
|
|
||||||
|
// clients support resuming of connections when signalling becomes disconnected
|
||||||
p.CloseSignalConnection(types.SignallingCloseReasonTransportFailure)
|
p.CloseSignalConnection(types.SignallingCloseReasonTransportFailure)
|
||||||
|
|
||||||
// detect when participant has actually left.
|
// 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) {
|
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
|
scr := types.SignallingCloseReasonUnknown
|
||||||
switch reason {
|
switch reason {
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ import (
|
|||||||
"github.com/livekit/protocol/utils/guid"
|
"github.com/livekit/protocol/utils/guid"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
|
||||||
|
|
||||||
//counterfeiter:generate . IOClient
|
//counterfeiter:generate . IOClient
|
||||||
type IOClient interface {
|
type IOClient interface {
|
||||||
CreateEgress(ctx context.Context, info *livekit.EgressInfo) (*emptypb.Empty, error)
|
CreateEgress(ctx context.Context, info *livekit.EgressInfo) (*emptypb.Empty, error)
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ import (
|
|||||||
"github.com/livekit/psrpc/pkg/middleware"
|
"github.com/livekit/psrpc/pkg/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
|
||||||
|
|
||||||
//counterfeiter:generate . SessionHandler
|
//counterfeiter:generate . SessionHandler
|
||||||
type SessionHandler interface {
|
type SessionHandler interface {
|
||||||
Logger(ctx context.Context) logger.Logger
|
Logger(ctx context.Context) logger.Logger
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import (
|
|||||||
"github.com/livekit/livekit-server/pkg/routing"
|
"github.com/livekit/livekit-server/pkg/routing"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . AnalyticsService
|
//counterfeiter:generate . AnalyticsService
|
||||||
type AnalyticsService interface {
|
type AnalyticsService interface {
|
||||||
SendStats(ctx context.Context, stats []*livekit.AnalyticsStat)
|
SendStats(ctx context.Context, stats []*livekit.AnalyticsStat)
|
||||||
SendEvent(ctx context.Context, events *livekit.AnalyticsEvent)
|
SendEvent(ctx context.Context, events *livekit.AnalyticsEvent)
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ import (
|
|||||||
"github.com/livekit/protocol/webhook"
|
"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 {
|
type TelemetryService interface {
|
||||||
// TrackStats is called periodically for each track in both directions (published/subscribed)
|
// TrackStats is called periodically for each track in both directions (published/subscribed)
|
||||||
TrackStats(key StatsKey, stat *livekit.AnalyticsStat)
|
TrackStats(key StatsKey, stat *livekit.AnalyticsStat)
|
||||||
|
|||||||
Reference in New Issue
Block a user