Rufus Scheduler 在多少个线程之后阻塞?
Rufus Scheduler blocks after how many threads?
在 rufus 中编写计划任务重叠的计划程序。这是预期的行为,但很好奇 rufus 如何处理重叠。它会重叠到 n 个线程然后从那里阻塞吗?或者它是否继续重叠而不关心一次有多少个并发任务运行。
理想情况下,我想利用 rufus 并发性,而不必管理我自己的托管线程池。我想在达到最大池数后阻止。
scheduler = Rufus::Scheduler.new
# Syncs one tenant in every call. Overlapping calls will allow for multiple
# syncs to occur until all threads expended, then blocks until a thread is available.
scheduler.every '30s', SingleTenantSyncHandler
编辑
从 README 可以看出 rufus 在版本 3.x 中确实使用了线程池。
您可以像这样设置最大线程数:
scheduler = Rufus::Scheduler.new(:max_work_threads => 77)
假设这回答了我的问题,但仍希望得到其他人的确认。
是的,我确认,https://github.com/jmettraux/rufus-scheduler/#max_work_threads 回答了您的问题。请注意,此线程池在 rufus-scheduler 实例中的所有计划作业之间共享。
在 rufus 中编写计划任务重叠的计划程序。这是预期的行为,但很好奇 rufus 如何处理重叠。它会重叠到 n 个线程然后从那里阻塞吗?或者它是否继续重叠而不关心一次有多少个并发任务运行。
理想情况下,我想利用 rufus 并发性,而不必管理我自己的托管线程池。我想在达到最大池数后阻止。
scheduler = Rufus::Scheduler.new
# Syncs one tenant in every call. Overlapping calls will allow for multiple
# syncs to occur until all threads expended, then blocks until a thread is available.
scheduler.every '30s', SingleTenantSyncHandler
编辑 从 README 可以看出 rufus 在版本 3.x 中确实使用了线程池。 您可以像这样设置最大线程数:
scheduler = Rufus::Scheduler.new(:max_work_threads => 77)
假设这回答了我的问题,但仍希望得到其他人的确认。
是的,我确认,https://github.com/jmettraux/rufus-scheduler/#max_work_threads 回答了您的问题。请注意,此线程池在 rufus-scheduler 实例中的所有计划作业之间共享。