diff --git a/actors/actor_system.go b/actors/actor_system.go index 1c31e0e..54f075a 100644 --- a/actors/actor_system.go +++ b/actors/actor_system.go @@ -201,8 +201,8 @@ type actorSystem struct { // specifies the stash capacity stashEnabled bool - stopGC chan types.Unit - gcInterval time.Duration + stopGC chan types.Unit + janitorInterval time.Duration // specifies the events stream eventsStream *eventstream.EventsStream @@ -252,7 +252,7 @@ func NewActorSystem(name string, opts ...Option) (ActorSystem, error) { shutdownTimeout: DefaultShutdownTimeout, stashEnabled: false, stopGC: make(chan types.Unit, 1), - gcInterval: DefaultGCInterval, + janitorInterval: DefaultJanitorInterval, eventsStream: eventstream.New(), partitionHasher: hash.DefaultHasher(), actorInitTimeout: DefaultInitTimeout, @@ -1170,7 +1170,7 @@ func (x *actorSystem) reset() { // that helps free non-utilized resources func (x *actorSystem) janitor() { x.logger.Info("janitor has started...") - ticker := time.NewTicker(x.gcInterval) + ticker := time.NewTicker(x.janitorInterval) tickerStopSig := make(chan types.Unit, 1) go func() { for { diff --git a/actors/api_test.go b/actors/api_test.go index c7b90b0..0a2b864 100644 --- a/actors/api_test.go +++ b/actors/api_test.go @@ -1380,7 +1380,7 @@ func TestRemoteAsk(t *testing.T) { sys, err := NewActorSystem("test", WithLogger(logger), WithPassivationDisabled(), - WithGCInterval(30*time.Millisecond), + WithJanitorInterval(30*time.Millisecond), WithRemoting(host, int32(remotingPort)), ) // assert there are no error @@ -1436,7 +1436,7 @@ func TestRemoteAsk(t *testing.T) { sys, err := NewActorSystem("test", WithLogger(logger), WithPassivationDisabled(), - WithGCInterval(30*time.Millisecond), + WithJanitorInterval(30*time.Millisecond), WithRemoting(host, int32(remotingPort)), ) // assert there are no error diff --git a/actors/option.go b/actors/option.go index f8d7074..86f76db 100644 --- a/actors/option.go +++ b/actors/option.go @@ -180,9 +180,9 @@ func WithPeerStateLoopInterval(interval time.Duration) Option { }) } -// WithGCInterval sets the GC interval -func WithGCInterval(interval time.Duration) Option { +// WithJanitorInterval sets the janitor interval +func WithJanitorInterval(interval time.Duration) Option { return OptionFunc(func(system *actorSystem) { - system.gcInterval = interval + system.janitorInterval = interval }) } diff --git a/actors/option_test.go b/actors/option_test.go index 8e5e0d8..4757112 100644 --- a/actors/option_test.go +++ b/actors/option_test.go @@ -125,8 +125,8 @@ func TestOption(t *testing.T) { }, { name: "WithGCInterval", - option: WithGCInterval(2 * time.Second), - expected: actorSystem{gcInterval: 2. * time.Second}, + option: WithJanitorInterval(2 * time.Second), + expected: actorSystem{janitorInterval: 2. * time.Second}, }, } for _, tc := range testCases { diff --git a/actors/types.go b/actors/types.go index e4ed06e..10c2de9 100644 --- a/actors/types.go +++ b/actors/types.go @@ -42,9 +42,9 @@ const ( // DefaultPeerStateLoopInterval defines the default peer state loop interval DefaultPeerStateLoopInterval = 10 * time.Second - // DefaultGCInterval defines the default GC interval + // DefaultJanitorInterval defines the default GC interval // This helps cleanup dead actors from the given actor system - DefaultGCInterval = 30 * time.Millisecond + DefaultJanitorInterval = 30 * time.Millisecond // eventsTopic defines the events topic eventsTopic = "topic.events"