Skip to content

Fix sleepWithCancel and ensure closed channel - #448

Merged
gabriel-samfira merged 1 commit into
cloudbase:mainfrom
gabriel-samfira:fix-sleep
Jul 7, 2025
Merged

Fix sleepWithCancel and ensure closed channel#448
gabriel-samfira merged 1 commit into
cloudbase:mainfrom
gabriel-samfira:fix-sleep

Conversation

@gabriel-samfira

Copy link
Copy Markdown
Member
  • time.NewTicker will panic if the duration is 0. Make it return early if duration is 0.
  • Return a pre-closed channel in Wait() instead of nil. Ensures receiver will not block forever.

I need to create a common type for workers and de-duplicate some of the code, now that we have a clear pattern in how they are set up.

* time.NewTicker will panic if the duration is 0. Make it return
early if duration is 0.
* Return a pre-closed channel in Wait() instead of nil. Ensures receiver
will not block forever.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
@gabriel-samfira
gabriel-samfira merged commit 19e025c into cloudbase:main Jul 7, 2025
4 checks passed
@gabriel-samfira
gabriel-samfira deleted the fix-sleep branch July 7, 2025 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant