Pergunta

I have this code in my rake task. It seems overkill, since the rake task is already being run as a cron job. I think I can safely take it out of Resque and run it directly, but not sure if I missed something.

   desc "update daily sales"
    task :daily_sales => :environment do
      Resque.enqueue(DailySaleService.perform)
    end 
Foi útil?

Solução

Yes, it's overkill. There is no reason to use background processing for a rake task; you use background processing to remove heavy lifting from the HTTP request/response cycle to provide users with a better front-end experience. It won't provide any value in a rake task.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top