device: extract pool into standalone package#54
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extracts the WaitPool implementation from the device package into a new standalone waitpool package so it can be imported independently of device.
Changes:
- Added a new
waitpoolpackage providingWaitPooland itsNew/Get/PutAPI. - Updated
deviceto usewaitpool.WaitPoolandwaitpool.Newfor its internal pools. - Moved existing pool tests into the
waitpoolpackage and updated references accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| waitpool/waitpool.go | Introduces the standalone WaitPool implementation. |
| waitpool/waitpool_test.go | Updates tests to target the new waitpool package and constructor name. |
| waitpool/race_enabled_test.go | Updates test package name to waitpool under -race build tag. |
| waitpool/race_disabled_test.go | Updates test package name to waitpool under !race build tag. |
| device/pools.go | Switches pool initialization from the old in-package type to waitpool.New. |
| device/device.go | Updates pool field types to *waitpool.WaitPool and imports waitpool. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0662310 to
3ade42b
Compare
Also fixes Put-before-Get underflow bug. Signed-off-by: Alex Valiushko <alexvaliushko@tailscale.com> Change-Id: Icde836d1bef2e95850d3ae51b3c069056a6a6964
3ade42b to
20486f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
e.g. to access it without importing
device.