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

update delayed_job #1284

Merged
merged 2 commits into from
Nov 20, 2024
Merged

update delayed_job #1284

merged 2 commits into from
Nov 20, 2024

Conversation

mwvolo
Copy link
Member

@mwvolo mwvolo commented Nov 20, 2024

A possible fix for emails sometimes going out and sometimes not.

From Dante:

this apparently doesn't work anymore: https://github.com/openstax/accounts/blob/main/config/initializers/active_job.rb#L2
Needs to be ActiveJob::Base.queue_adapter = :delayed_job instead
So all jobs are running async in the same thread

@Dantemss
Copy link
Member

The config doesn't work because ActiveJob is being loaded before the config is set.

Maybe the best way is actually something like:
ActiveSupport.on_load(:active_job) { ActiveJob::Base.queue_adapter = :delayed_job }

Since something else (some gem?) is already loading ActiveJob too early, I guess it doesn't matter much. But I might change to that eventually so we don't contribute to the problem by also loading ActiveJob::Base too early ourselves.

@mwvolo
Copy link
Member Author

mwvolo commented Nov 20, 2024

are you saying that's what should be in the initializer file instead of this?

@mwvolo
Copy link
Member Author

mwvolo commented Nov 20, 2024

like this? 708fa1e

@Dantemss
Copy link
Member

Yeah that looks good, to prevent the initializer itself from loading ActiveJob too early.

@mwvolo mwvolo merged commit 147f8de into main Nov 20, 2024
7 checks passed
@mwvolo mwvolo deleted the queue-adapter branch November 20, 2024 17:45
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

Successfully merging this pull request may close these issues.

2 participants