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 block based invokations #32

Open
krainboltgreene opened this issue Feb 27, 2018 · 3 comments
Open

Support block based invokations #32

krainboltgreene opened this issue Feb 27, 2018 · 3 comments

Comments

@krainboltgreene
Copy link

Sometimes migrations do quite a lot of things and you might need different locks/timeouts inside a single change/up/down:

def change
  with_timeout lock: 10.seconds do
    # ...
  end

  # ...

  with_timeout statement: 10.minutes do
    # ...
  end

  # ...

  with_timeout lock: 5.seconds, statement: 10.hours do
    # ...
  end
end
@Sinjo
Copy link
Contributor

Sinjo commented Mar 5, 2018

Hi @krainboltgreene,

Thanks for the suggestion. We'll have a think about it.

Our current approach to this is to bundle changes with similar requirements into their own migration files. They can still go out in a single deployment, so we don't find it's a huge amount of overhead.

@krainboltgreene
Copy link
Author

krainboltgreene commented Mar 5, 2018

I hear ya, there's not an incredibly compelling reason for it other than it mimes other active record interfaces (and ones they've recently introduced as an addition, see: add_foreign_key and table.foreign_key).

@seanlinsley
Copy link

@krainboltgreene (hi!) what timeout would you expect to be applied to code executed outside of the with_timeout block? I guess it'd all be in the same transaction & would run a lot of set commands to switch between the local override & the default as configured in the gem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants