withRead<T> method

Future<T> withRead<T>(
  1. String table,
  2. Future<T> fn(), {
  3. int timeoutMs = 5000,
})

Implementation

Future<T> withRead<T>(String table, Future<T> Function() fn,
    {int timeoutMs = 5000}) async {
  final g = await acquireRead(table, timeoutMs: timeoutMs);
  try {
    return await fn();
  } finally {
    release(g);
  }
}