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

Support for locks #4

Open
Sleavely opened this issue Apr 26, 2020 · 1 comment
Open

Support for locks #4

Sleavely opened this issue Apr 26, 2020 · 1 comment
Labels
discussion Extra attention is needed enhancement New feature or request

Comments

@Sleavely
Copy link
Owner

Sleavely commented Apr 26, 2020

If using a state store such as a database, multiple users may be trying to perform migrations at the same time. This would yield unwanted results.

Suggested sample configuration:

{
  /**
   * Invoked at the beginning of a migration round to establish a global lock.
   * If `lockTimeout` has been specified, this method will be wrapped
   * in Promise.race() against a timer that causes the migration to fail.
   *
   * @param context
   * @return Once a lock has been obtained.
   */
  lock: async (context) => {},

  /**
   * Invoked to release any global lock acquired by the `lock` function.
   */
  unlock: async (context) => {},

  /**
   * The number of milliseconds to give up after if a lock cannot be obtained
   * or released. This is only applicable if the `lock` function is implemented.
   */
  lockTimeout: 0,
}
@Sleavely Sleavely added the enhancement New feature or request label Apr 27, 2020
@Sleavely
Copy link
Owner Author

This is one of the features that exist in migrat but I'm not sure whether it would be overdoing it or if it's useful. Marking as discussion for now.

@Sleavely Sleavely added the discussion Extra attention is needed label May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Extra attention is needed enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant