Commit 62254e93 by Ngô Trung Hưng

add backgroub job

parent 897ec388
Pipeline #1113 failed with stages
in 0 seconds
......@@ -38,6 +38,7 @@ gem 'i18n-js'
gem 'rsolr'
gem 'config'
gem 'therubyracer'
gem 'sidekiq'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
......
......@@ -110,6 +110,7 @@ GEM
config (2.2.1)
deep_merge (~> 1.2, >= 1.2.1)
dry-validation (~> 1.0, >= 1.0.0)
connection_pool (2.2.3)
crass (1.0.6)
deep_merge (1.2.1)
devise (4.7.3)
......@@ -270,6 +271,7 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.2.2)
ref (2.0.0)
regexp_parser (1.8.0)
request_store (1.5.0)
......@@ -311,6 +313,10 @@ GEM
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
sidekiq (6.1.2)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
spring (2.1.1)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
......@@ -392,6 +398,7 @@ DEPENDENCIES
rubocop
sass-rails (~> 5.0)
selenium-webdriver
sidekiq
spring
spring-watcher-listen (~> 2.0.0)
therubyracer
......
......@@ -33,7 +33,7 @@ class ApplyJobController < ApplicationController
apply_data.job_id = session[:job_id]
apply_data.cv.retrieve_from_cache!(session[:cache_name])
if apply_data.save
AppliedMailer.applied_job_mail_to(apply_data).deliver_now
SendEmailJob.set(wait: 10.seconds).perform_later(apply_data)
render :done
else
flash[:error] = t('apply_job.error')
......
class SendEmailJob < ApplicationJob
queue_as :default
def perform(obj)
AppliedMailer.applied_job_mail_to(obj).deliver_now
end
end
......@@ -21,5 +21,6 @@ module Venjob
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
config.active_job.queue_adapter = :sidekiq
end
end
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment