Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expiring Locks. #1

Open
azjezz opened this issue Mar 2, 2019 · 0 comments
Open

Expiring Locks. #1

azjezz opened this issue Mar 2, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@azjezz
Copy link
Owner

azjezz commented Mar 2, 2019

example :

$lock = await $mutex->acquire(
  'foo', 
  300, // Expiring time in seconds
);

do {

  // do things

  if (bar()) {
    $finished = false;
  } else {
    $finished = true;
  }

  if (!$finished  && $mutex->getRemainingLifetime($lock) <= 5) {
    invariant(!$mutex->isExpired($lock), 'Lock lost during the overall process');

    await $mutex->refresh($lock);
  }

} while(!$finished);
@azjezz azjezz added the enhancement New feature or request label Mar 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant