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

Add basic threading strategy support #612

Merged
merged 16 commits into from
Sep 11, 2024
Merged

Add basic threading strategy support #612

merged 16 commits into from
Sep 11, 2024

Conversation

twyatt
Copy link
Member

@twyatt twyatt commented Dec 18, 2023

Closes #577.

@twyatt twyatt added the minor Changes that should bump the MINOR version number label Dec 18, 2023
@twyatt twyatt changed the title Implement basic threading strategy support Add basic threading strategy support Dec 18, 2023
@twyatt twyatt added the android label Dec 18, 2023
@twyatt

This comment was marked as resolved.

@twyatt twyatt force-pushed the twyatt/threading-strategy branch 2 times, most recently from db51d83 to ceba0b9 Compare August 1, 2024 19:51
@twyatt twyatt changed the base branch from main to twyatt/is-supported August 22, 2024 20:03
@twyatt twyatt marked this pull request as ready for review August 22, 2024 20:15
@twyatt twyatt requested a review from a team as a code owner August 22, 2024 20:15
@twyatt twyatt requested review from QuantumRand and davidtaylor-juul and removed request for a team August 22, 2024 20:15
guard.withLock {
pool.removeAll { (timeMark) -> timeMark.hasPassedNow() }
}
delay(evictAfter / 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why half the eviction time? Sqrt might be a little more flexible.

Copy link
Member Author

@twyatt twyatt Aug 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was trying to find a balance between checking too often and not having threads stay alive for a lot longer than needed.

I do like sqrt for this, but unfortunately evictAfter is a Duration; whereas Duration.div(Int) is provided, but a Duration.sqrt function is not. I could convert to milliseconds for all durations, do the sqrt operation, then convert back, but that seems like an unnecessary amount of complexity for little gain?

Perhaps dividing by 3 would be better?

@twyatt twyatt added this to the 0.35.0 milestone Aug 24, 2024
Base automatically changed from twyatt/is-supported to main August 24, 2024 07:45
@twyatt twyatt enabled auto-merge (squash) September 11, 2024 17:40
@twyatt twyatt merged commit ed9ea5b into main Sep 11, 2024
2 checks passed
@twyatt twyatt deleted the twyatt/threading-strategy branch September 11, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android minor Changes that should bump the MINOR version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spin down thread on disconnect
3 participants