8000 Reloadable buffer pools by vigoo · Pull Request #6447 · zio/zio · GitHub
[go: up one dir, main page]

Skip to content

Reloadable buffer pools - #6447

Merged
vigoo merged 4 commits into
zio:series/2.xfrom
vigoo:issue-6434-3
Mar 18, 2022
Merged

vigoo merged 4 commits into
zio:series/2.xfrom
vigoo:issue-6434-3

Conversation

@vigoo
@vigoo vigoo commented Mar 18, 2022
Copy link
Copy Markdown
Contributor

No description provided.

@vigoo
vigoo requested a review from jdegoes March 18, 2022 15:19
_ <- threadsStartedTotal.launch(schedule.updateMetrics)
_ <- threadsDeadlocked.launch(schedule.updateMetrics)
_ <- threadsDeadlockedMonitor.launch(schedule.updateMetrics)
_ <- ZIO.acquireRelease(refreshThreadStateCounts(threadMXBean).repeat(schedule.updateMetrics).forkDaemon)(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be:

ZIO.acquireRelease(ZIO.interruptibly(refreshThreadStateCounts(threadMXBean).repeat(schedule.updateMetrics).)forkDaemon)(

Otherwise it will hang shutdown because it can't be interrupted. Please make this change for all the other ZIO.acquireRelease ones.

Also, maybe we are missing something to accomplish this?

e.g. .scheduleBackground which could return ZIO[Scope, ...] and handle this messy part.

@jdegoes jdegoes left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks really good! I have have one comment on ZIO.acquireRelease hanging the finalizers because the acquire action is not interruptible.

* metrics
*/
final case class JvmMetricsSchedule(
updateMetrics: Schedule[Any, Any, Unit],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's change the return type of these two schedules to Any, e.g.:

Suggested change
updateMetrics: Schedule[Any, Any, Unit],
updateMetrics: Schedule[Any, Any, Any],

etc.

jdegoes
jdegoes previously approved these changes Mar 18, 2022
jdegoes
jdegoes previously approved these changes Mar 18, 2022
final def scheduleBackground[R1 <: R, B](schedule: => Schedule[R1, Any, B])(implicit
trace: ZTraceElement
): ZIO[R1 with Clock with Scope, E, B] =
): ZIO[R1 with Clock with Scope, E, Fiber[Any, B]] =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can delete the type parameter B and use Any for that slot in Schedule.

@vigoo
vigoo merged commit 7e5d7df into zio:series/2.x Mar 18, 2022
@vigoo
vigoo deleted the issue-6434-3 branch March 18, 2022 16:25
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.

2 participants

0