Skip to content

Commit 83f07d5

Browse files
committed
Address PR review comments: improve documentation and logging
- Add detailed documentation comments for hardcoded timeout values explaining the rationale behind the chosen durations (2 minutes cleanup timeout and 5 second poll interval) - Change field selector fallback logging from Info to debug level (V(1)) to reduce noise during normal operation, especially in test environments Addresses: - #97 (comment) - #97 (comment)
1 parent 5c5f8aa commit 83f07d5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/controller/worker_controller.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ const (
4141
temporalWorkerDeploymentFinalizer = "temporal.io/temporal-worker-deployment-finalizer"
4242

4343
// Cleanup timeout and polling constants
44-
cleanupTimeout = 2 * time.Minute
44+
// cleanupTimeout defines the maximum time to wait for all owned deployments to be deleted
45+
// during finalizer cleanup. 2 minutes is chosen to allow sufficient time for Kubernetes to
46+
// process deployment deletions while preventing indefinite blocking during shutdown.
47+
cleanupTimeout = 2 * time.Minute
48+
// cleanupPollInterval defines how frequently to check if owned deployments have been deleted
49+
// during cleanup. 5 seconds provides a reasonable balance between responsiveness and
50+
// avoiding excessive API calls during the cleanup process.
4551
cleanupPollInterval = 5 * time.Second
4652
)
4753

@@ -254,7 +260,7 @@ func (r *TemporalWorkerDeploymentReconciler) cleanupManagedResources(ctx context
254260
err := r.List(ctx, deploymentList, listOpts)
255261
if err != nil {
256262
// If field selector fails (common in tests), fall back to listing all deployments
257-
l.Info("Field selector not available, falling back to listing all deployments", "error", err.Error())
263+
l.V(1).Info("Field selector not available, falling back to listing all deployments", "error", err.Error())
258264
listOpts = &client.ListOptions{
259265
Namespace: workerDeploy.Namespace,
260266
}

0 commit comments

Comments
 (0)