mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
* Allow DB::Pool to be a generic connection pool * Use fully qualified class name for consistency Co-authored-by: Brian J. Cardiff <bcardiff@gmail.com> * Wrap only the necessary code in an `ensure` * Add spec for http client pool * Fix ICE in crystal-sqlite3 Co-authored-by: Brian J. Cardiff <bcardiff@gmail.com>
17 lines
425 B
Crystal
17 lines
425 B
Crystal
def wait_until_blocked(f : Fiber, timeout = 5.seconds)
|
|
now = Time.monotonic
|
|
|
|
until f.resumable?
|
|
Fiber.yield
|
|
raise "fiber failed to block within #{timeout}" if (Time.monotonic - now) > timeout
|
|
end
|
|
end
|
|
|
|
def wait_until_finished(f : Fiber, timeout = 5.seconds)
|
|
now = Time.monotonic
|
|
until f.dead?
|
|
Fiber.yield
|
|
raise "fiber failed to finish within #{timeout}" if (Time.monotonic - now) > timeout
|
|
end
|
|
end
|