releaseSchedulerLock function

Future<void> releaseSchedulerLock({
  1. SchedulerLockOptions? opts,
  2. String? sessionId,
})

Release the scheduler lock if the current session owns it.

Implementation

Future<void> releaseSchedulerLock({
  SchedulerLockOptions? opts,
  String? sessionId,
}) async {
  _lastBlockedBy = null;
  final dir = opts?.dir;
  final identity = opts?.lockIdentity ?? sessionId ?? 'unknown';
  final existing = await _readLock(dir: dir);
  if (existing == null || existing.sessionId != identity) return;
  try {
    await File(_getLockPath(dir: dir)).delete();
  } catch (_) {
    // Already gone.
  }
}