-
Notifications
You must be signed in to change notification settings - Fork 83
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
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
76662a9
to
e6fd150
Compare
db51d83
to
ceba0b9
Compare
It was not needed for scan exception changes.
ceba0b9
to
e99c94c
Compare
e99c94c
to
ea0acd4
Compare
guard.withLock { | ||
pool.removeAll { (timeMark) -> timeMark.hasPassedNow() } | ||
} | ||
delay(evictAfter / 2) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
Closes #577.