Fix idle resource removal in the resource pool
This commit is contained in:
parent
a2ab770536
commit
bddc6c04ad
2 changed files with 23 additions and 8 deletions
|
@ -72,6 +72,27 @@
|
|||
|
||||
(destroy-resource-pool resource-pool))))
|
||||
|
||||
(run-fibers-for-tests
|
||||
(lambda ()
|
||||
(let ((resource-pool (make-resource-pool
|
||||
new-number
|
||||
2
|
||||
#:idle-seconds 0.5
|
||||
#:destructor
|
||||
(lambda (res)
|
||||
#t))))
|
||||
(fibers-for-each
|
||||
(lambda _
|
||||
(with-resource-from-pool resource-pool
|
||||
res
|
||||
res))
|
||||
(iota 20))
|
||||
|
||||
(let loop ((stats (resource-pool-stats resource-pool)))
|
||||
(unless (= 0 (assq-ref stats 'resources))
|
||||
(sleep 0.1)
|
||||
(loop (resource-pool-stats resource-pool)))))))
|
||||
|
||||
(run-fibers-for-tests
|
||||
(lambda ()
|
||||
(let* ((counter 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue