Commit cd393a68 by Ngô Trung Hưng

add backgroud job to devise

parent 56d67fde
Pipeline #1120 failed with stages
in 0 seconds
...@@ -39,6 +39,8 @@ gem 'rsolr' ...@@ -39,6 +39,8 @@ gem 'rsolr'
gem 'config' gem 'config'
gem 'therubyracer' gem 'therubyracer'
gem 'sidekiq' gem 'sidekiq'
gem 'devise-async'
gem 'mailcatcher'
# Use ActiveStorage variant # Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8' # gem 'mini_magick', '~> 4.8'
......
...@@ -112,6 +112,7 @@ GEM ...@@ -112,6 +112,7 @@ GEM
dry-validation (~> 1.0, >= 1.0.0) dry-validation (~> 1.0, >= 1.0.0)
connection_pool (2.2.3) connection_pool (2.2.3)
crass (1.0.6) crass (1.0.6)
daemons (1.3.1)
deep_merge (1.2.1) deep_merge (1.2.1)
devise (4.7.3) devise (4.7.3)
bcrypt (~> 3.0) bcrypt (~> 3.0)
...@@ -119,6 +120,9 @@ GEM ...@@ -119,6 +120,9 @@ GEM
railties (>= 4.1.0) railties (>= 4.1.0)
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
devise-async (1.0.0)
activejob (>= 5.0)
devise (>= 4.0)
dotenv (2.7.6) dotenv (2.7.6)
dotenv-rails (2.7.6) dotenv-rails (2.7.6)
dotenv (= 2.7.6) dotenv (= 2.7.6)
...@@ -168,12 +172,16 @@ GEM ...@@ -168,12 +172,16 @@ GEM
dry-initializer (~> 3.0) dry-initializer (~> 3.0)
dry-schema (~> 1.5, >= 1.5.2) dry-schema (~> 1.5, >= 1.5.2)
erubi (1.9.0) erubi (1.9.0)
eventmachine (1.2.7)
execjs (2.7.0) execjs (2.7.0)
faraday (1.0.1) faraday (1.0.1)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ffi (1.13.1) ffi (1.13.1)
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
haml (5.2.0)
temple (>= 0.8.0)
tilt
i18n (1.8.5) i18n (1.8.5)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
i18n-js (3.7.1) i18n-js (3.7.1)
...@@ -184,6 +192,7 @@ GEM ...@@ -184,6 +192,7 @@ GEM
io-like (0.3.1) io-like (0.3.1)
jbuilder (2.10.1) jbuilder (2.10.1)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
json (2.3.1)
kaminari (1.2.1) kaminari (1.2.1)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1) kaminari-actionview (= 1.2.1)
...@@ -207,6 +216,16 @@ GEM ...@@ -207,6 +216,16 @@ GEM
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
mailcatcher (0.2.4)
eventmachine
haml
i18n
json
mail
sinatra
skinny (>= 0.1.2)
sqlite3-ruby
thin
marcel (0.3.3) marcel (0.3.3)
mimemagic (~> 0.3.2) mimemagic (~> 0.3.2)
method_source (0.9.2) method_source (0.9.2)
...@@ -217,6 +236,8 @@ GEM ...@@ -217,6 +236,8 @@ GEM
minitest (5.14.2) minitest (5.14.2)
msgpack (1.3.3) msgpack (1.3.3)
multipart-post (2.1.1) multipart-post (2.1.1)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
mysql2 (0.5.3) mysql2 (0.5.3)
net-scp (3.0.0) net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0) net-ssh (>= 2.6.5, < 7.0.0)
...@@ -236,6 +257,8 @@ GEM ...@@ -236,6 +257,8 @@ GEM
public_suffix (4.0.6) public_suffix (4.0.6)
puma (3.12.6) puma (3.12.6)
rack (2.2.3) rack (2.2.3)
rack-protection (2.1.0)
rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (5.2.4.4) rails (5.2.4.4)
...@@ -297,6 +320,7 @@ GEM ...@@ -297,6 +320,7 @@ GEM
ruby-progressbar (1.10.1) ruby-progressbar (1.10.1)
ruby-vips (2.0.17) ruby-vips (2.0.17)
ffi (~> 1.9) ffi (~> 1.9)
ruby2_keywords (0.0.2)
ruby_dep (1.5.0) ruby_dep (1.5.0)
rubyzip (2.3.0) rubyzip (2.3.0)
sass (3.7.4) sass (3.7.4)
...@@ -317,6 +341,14 @@ GEM ...@@ -317,6 +341,14 @@ GEM
connection_pool (>= 2.2.2) connection_pool (>= 2.2.2)
rack (~> 2.0) rack (~> 2.0)
redis (>= 4.2.0) redis (>= 4.2.0)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
skinny (0.2.2)
eventmachine (~> 1.0)
thin
spring (2.1.1) spring (2.1.1)
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
...@@ -328,12 +360,20 @@ GEM ...@@ -328,12 +360,20 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.4.2)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
sshkit (1.21.0) sshkit (1.21.0)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
temple (0.8.2)
therubyracer (0.12.3) therubyracer (0.12.3)
libv8 (~> 3.16.14.15) libv8 (~> 3.16.14.15)
ref ref
thin (1.7.2)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (1.0.1) thor (1.0.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
...@@ -381,12 +421,14 @@ DEPENDENCIES ...@@ -381,12 +421,14 @@ DEPENDENCIES
coffee-rails (~> 4.2) coffee-rails (~> 4.2)
config config
devise devise
devise-async
dotenv-rails dotenv-rails
draper draper
i18n-js i18n-js
jbuilder (~> 2.5) jbuilder (~> 2.5)
kaminari kaminari
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
mailcatcher
mysql2 (>= 0.4.4, < 0.6.0) mysql2 (>= 0.4.4, < 0.6.0)
nokogiri nokogiri
pry pry
......
...@@ -6,7 +6,7 @@ class User < ApplicationRecord ...@@ -6,7 +6,7 @@ class User < ApplicationRecord
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
VALID_LANG_CODES = %w[vi en].freeze VALID_LANG_CODES = %w[vi en].freeze
mount_uploader :cv, CvUploader mount_uploader :cv, CvUploader
devise :database_authenticatable, :registerable, devise :database_authenticatable, :registerable, :async,
:recoverable, :rememberable, :validatable, :confirmable :recoverable, :rememberable, :validatable, :confirmable
has_many :applied_jobs has_many :applied_jobs
has_many :jobs, through: :applied_jobs has_many :jobs, through: :applied_jobs
...@@ -22,4 +22,8 @@ class User < ApplicationRecord ...@@ -22,4 +22,8 @@ class User < ApplicationRecord
self.language = new_lang self.language = new_lang
save save
end end
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
end end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<%= link_to 'Crontab', '#', class: 'is_active'%> <%= link_to 'Crontab', '#', class: 'is_active'%>
</li> </li>
<li> <li>
<%= link_to 'Themes', '#' %> <%= link_to 'List Applied', applies_index_path %>
</li> </li>
</ul> </ul>
</div> </div>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<%= link_to t('pages.index.signout'), destroy_user_session_path, method: :delete, class: 'link_item_menu_header_right'%> <%= link_to t('pages.index.signout'), destroy_user_session_path, method: :delete, class: 'link_item_menu_header_right'%>
</li> </li>
<li class="list_item_menu_header_right"> <li class="list_item_menu_header_right">
<span class="link_item_menu_header_right"><i class="far fa-question-circle"></i></span> <%= link_to 'Settings', settings_path, class: 'link_item_menu_header_right'%>
</li> </li>
<% else %> <% else %>
<li class="list_item_menu_header_right"> <li class="list_item_menu_header_right">
......
# Supported options: :resque, :sidekiq, :delayed_job
Devise::Async.setup do |config|
config.enabled = true
end
...@@ -7,11 +7,11 @@ env :PATH, ENV['PATH'] ...@@ -7,11 +7,11 @@ env :PATH, ENV['PATH']
set :environment, Rails.env || 'production' set :environment, Rails.env || 'production'
every 1.hours do every 1.hours do
# rake 'crawler:populate' rake 'crawler:populate'
end end
every 1.minute do every 1.minute do
rake 'advertise:send_email' # rake 'advertise:send_email'
end end
every 1.day, at: '2:30 am' do every 1.day, at: '2:30 am' do
......
:queues:
- mailers
- default
\ No newline at end of file
#!/bin/sh
redis-server
bundle exec sidekiq -e development -q mailers -q default
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