Skip to content

Commit b151955

Browse files
committed
(PE-37376) Initialize one JRuby instance first even when refilling a pool
1 parent 14da1ef commit b151955

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: src/clj/puppetlabs/services/jruby_pool_manager/impl/jruby_agents.clj

+6-2
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,13 @@
183183
(throw (IllegalStateException.
184184
(i18n/trs "There was a problem creating a JRubyInstance for the pool.")
185185
e)))))
186-
cleanup-and-refill-tasks (for [[old-instance new-id] (zipmap old-instances new-instance-ids)]
186+
[[first-old-inst first-new-id] & remaining] (zipmap old-instances new-instance-ids)
187+
first-task [(fn [] (cleanup-and-refill-instance first-old-inst first-new-id))]
188+
remaining-tasks (for [[old-instance new-id] remaining]
187189
(fn [] (cleanup-and-refill-instance old-instance new-id)))]
188-
(execute-tasks! cleanup-and-refill-tasks creation-service))
190+
(execute-tasks! first-task creation-service)
191+
(when remaining-tasks
192+
(execute-tasks! remaining-tasks creation-service)))
189193
(if refill?
190194
(log/info (i18n/trs "Finished draining and refilling pool."))
191195
(log/info (i18n/trs "Finished draining pool."))))

0 commit comments

Comments
 (0)