renew method
Extends the lock TTL when the owner still holds it.
Implementation
@override
/// Extends the lock TTL when the [owner] still holds it.
Future<bool> renew(String key, String owner, Duration ttl) async {
final lock = _locks[key];
if (lock == null) {
return false;
}
if (lock.owner != owner) {
return false;
}
final now = stemNow();
if (lock.isExpired(now)) {
_locks.remove(key);
return false;
}
lock.expiresAt = now.add(ttl);
return true;
}