-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat(): add delayed job recipe #41
Merged
+25
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
lib/potassium/templates/application/recipes/asks/delayed_job.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
use_delayed_job = Ask.confirm "Do you want to use delayed jobs?" | ||
set(:delayed_job, use_delayed_job) |
16 changes: 16 additions & 0 deletions
16
lib/potassium/templates/application/recipes/delayed_job.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
if selected?(:delayed_job) | ||
gather_gem "delayed_job_active_record" | ||
|
||
delayed_job_config = "config.active_job.queue_adapter = :delayed_job" | ||
application(delayed_job_config) | ||
|
||
after(:gem_install) do | ||
generate "delayed_job:active_record" | ||
|
||
if selected?(:heroku) | ||
gsub_file "Procfile", /^.*$/m do |match| | ||
"#{match}worker: bundle exec rake jobs:work" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
porque hay que agregar la gema "daemons"??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blackjid por esto: https://github.com/collectiveidea/delayed_job#running-jobs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
creo que como ahora usamos heroku, y el comando se agrega en el Procfile, ya no hay necesidad de esto.
Heroku se encargara de mantener corriendo ese proceso.
Ademas como bien pusiste en el
Procfile
ya no usariamos el comandobin/delayed_jobs
mencionado ahi, sino que el task que provee activejob...mmmm, pensandolo bien.... usamos activejob para delayed_jobs en platanus??? cual crees que la practica comun?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ActiveJob es relativamente nuevo y no he tenido mucha oportunidad de verlo en un proyecto nuevo. Sin embargo, es mucho más simple y escalable usarlo que no (en tanto, si la bd se vuelve un cuello de botella gracias a DJ, uno puede migrar casi con nada a resque, sidekiq u otros). Por eso creo que deberíamos usarlo de ese modo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,
entonces habria que sacar
daemons
, ya que vamos a usar activejob, vamos ha echar a andar el proceso con las tareas que provee activejobs, ademas de que heroku se encarga de el proceso.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De acuerdo con lo que dice @juliogarciag , saco
daemons
entonces.