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

Appears to timeout while running callbacks #216

Open
etherbob opened this issue Jun 3, 2022 · 1 comment
Open

Appears to timeout while running callbacks #216

etherbob opened this issue Jun 3, 2022 · 1 comment

Comments

@etherbob
Copy link

etherbob commented Jun 3, 2022

We have some models with after_commit callbacks around ActiveStorage and some other external interactions that appear to be running after the data migration has completed. In the case of the ActiveStorage attachments they get cut off and raise exceptions. We don't get this behavior if we run the same code from a rake task or in the console.

We're on rails 6.1.4.1 and the latest pub release of the data-migrate gem.

👉 bin/rails data:migrate
== 20220602165945 AddGifCreditProducts: migrating =============================
successfully added gif credits for Denver
successfully added gif credits for Seattle
successfully added gif credits for Minneapolis
successfully added gif credits for Austin
successfully added gif credits for Digital Fulfillment Studio
successfully added gif credits for Los Angeles
== 20220602165945 AddGifCreditProducts: migrated (0.3966s) ====================

rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

closed stream
/path-to-rails-app/bin/rails:9:in `<top (required)>'
/path-to-rails-app/bin/spring:15:in `<top (required)>'

Caused by:
IOError: closed stream
/path-to-rails-app/bin/rails:9:in `<top (required)>'
/path-to-rails-app/bin/spring:15:in `<top (required)>'
Tasks: TOP => data:migrate
(See full trace by running task with --trace)
@etherbob
Copy link
Author

adding disable_ddl_transaction! to the migration runs each commit and it's callbacks inside the transaction and was good enough for us, even if we miss the all-or-nothing nature of a wrapping transaction.

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

1 participant