Commit b73f6ed7 by Xuan Trung Le

install sidekiq

parent 022b3d72
......@@ -21,6 +21,7 @@ gem 'devise'
gem 'carrierwave'
gem 'kaminari'
gem "settingslogic"
gem 'sidekiq'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
......@@ -30,10 +31,8 @@ end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
......
......@@ -48,6 +48,7 @@ GEM
activesupport (>= 4.0.0)
mime-types (>= 1.16)
concurrent-ruby (1.0.5)
connection_pool (2.2.1)
crass (1.0.2)
devise (4.3.0)
bcrypt (~> 3.0)
......@@ -75,10 +76,6 @@ GEM
activerecord
kaminari-core (= 1.0.1)
kaminari-core (1.0.1)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.1.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
......@@ -97,6 +94,8 @@ GEM
orm_adapter (0.5.0)
puma (3.10.0)
rack (2.0.3)
rack-protection (2.0.0)
rack
rack-test (0.7.0)
rack (>= 1.0, < 3)
rails (5.1.4)
......@@ -126,10 +125,10 @@ GEM
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
redis (4.0.1)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
ruby_dep (1.5.0)
sass (3.5.1)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
......@@ -142,11 +141,13 @@ GEM
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
settingslogic (2.0.9)
sidekiq (5.0.5)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
redis (>= 3.3.4, < 5)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
......@@ -181,14 +182,13 @@ DEPENDENCIES
devise
figaro
kaminari
listen (>= 3.0.5, < 3.2)
mysql2 (>= 0.3.18, < 0.5)
puma (~> 3.7)
rails (~> 5.1.4)
sass-rails (~> 5.0)
settingslogic
sidekiq
spring
spring-watcher-listen (~> 2.0.0)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
......
......@@ -40,7 +40,7 @@ class AppliesController < ApplicationController
cv: session[:candidate_cv])
if @application.save
flash[:notice] = 'Congratulation! Job was successfully applied'
ApplyJobMailer.successful_email(@application).deliver
EmailWorker.perform_in(1.seconds, @application.id)
clear_session
end
end
......
class EmailWorker
include Sidekiq::Worker
def perform(application_id)
application = ApplyJob.find(application_id)
ApplyJobMailer.successful_email(application).deliver
end
end
......@@ -48,9 +48,9 @@ Rails.application.configure do
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = { address: 'localhost',
# port: 1025 }
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
......
Rails.application.routes.draw do
require 'sidekiq/web'
root 'jobs#index'
devise_for :users
......@@ -14,4 +15,5 @@ Rails.application.routes.draw do
get 'apply' => "applies#apply"
post 'confirm' => "applies#confirm"
post 'done' => "applies#done"
mount Sidekiq::Web, at: '/sidekiq'
end
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