def acquire_wait.started
mylsm-lsm-store@0.6.0.1 · src/DbLock.bend:322
import mylsm-lsm-store@0.6.0.1/src/DbLock.bend as DbLock
import Base
import mylsm-lsm-store@0.6.0.1/src/DurableError.bend as DurableError
322
323def acquire_wait.started(
324 file: File,
325 operation: String,
326 path: String,
327 timeout_ms: U32,
328 backoff_ms: U32,
329 result: Result<&1, &1, U32 & String, Nat>
330) -> IO(Result<&1, &1, DurableError.Error, Lock>):
331 match result:
332 case Fail{error}:
333 wait.host_error(file, error, operation, path)
334 case Done{started_us}:
335 +timeout = U32.to_nat(timeout_ms)
336 fuel = Nat.add(Nat.mul(timeout, 8n), 8n)
337 wait.loop(fuel, TryLock{file, started_us, timeout, backoff_ms,
338 operation, path})