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

refactor: rename gcInternal to janitorInterval to avoid confusing with Go GC #463

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions actors/actor_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions actors/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions actors/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
4 changes: 2 additions & 2 deletions actors/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions actors/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down