Repository: Tochemey/goakt
Pull request #463 (2024-09-12 07:14:07)

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

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/Tochemey/goakt/pull/463?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arsene) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 87.75%. Comparing base [(`5ac03f8`)](https://app.codecov.io/gh/Tochemey/goakt/commit/5ac03f8ba57f72847f5a1d2fa8678f443ad02854?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arsene) to head [(`80f733f`)](https://app.codecov.io/gh/Tochemey/goakt/commit/80f733ffee4d19dc3d3732d90f246cbf5e762d9e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arsene).

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main     #463   +/-   ##
=======================================
  Coverage   87.75%   87.75%           
=======================================
  Files          46       46           
  Lines        3561     3561           
=======================================
  Hits         3125     3125           
  Misses        308      308           
  Partials      128      128           
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/Tochemey/goakt/pull/463?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arsene).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arsene).


Patch:
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/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/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"
 


Test patch:
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_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 {