Skip to content

Commit

Permalink
move weekly digest email to sidekiq-cron and remove whenever
Browse files Browse the repository at this point in the history
  • Loading branch information
markets committed Aug 15, 2018
1 parent c4fb4aa commit 762b473
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 80 deletions.
6 changes: 1 addition & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ gem 'unicorn'
gem 'kaminari', '~> 1.1.1'
gem "simple_form", ">= 3.0.0"
gem 'rollbar', '2.8.3'
gem 'whenever', require: false
gem 'prawn', '~> 2.2.0'
gem 'prawn-table', '~> 0.2.2'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'skylight'
gem 'sidekiq', '5.1.3'
gem 'sidekiq-cron', '0.6.3'
# TODO: remove this once the following issue has been addressed
# https://github.com/ondrejbartas/sidekiq-cron/issues/199
gem 'rufus-scheduler', '~> 3.4.2'
gem 'sidekiq-cron', '~> 1.0.4'

# Assets
gem 'jquery-rails', '>= 4.2.0'
Expand Down
19 changes: 8 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ GEM
chromedriver-helper (1.2.0)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
chronic (0.10.2)
coderay (1.1.2)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
Expand Down Expand Up @@ -144,7 +143,7 @@ GEM
multi_json
erubi (1.7.1)
erubis (2.7.0)
et-orbi (1.1.2)
et-orbi (1.1.4)
tzinfo
execjs (2.6.0)
fabrication (2.11.3)
Expand All @@ -156,6 +155,9 @@ GEM
formtastic (3.1.5)
actionpack (>= 3.2.13)
formtastic_i18n (0.6.0)
fugit (1.1.5)
et-orbi (~> 1.1, >= 1.1.3)
raabro (~> 1.1)
gli (2.16.0)
globalid (0.4.1)
activesupport (>= 4.2.0)
Expand Down Expand Up @@ -241,6 +243,7 @@ GEM
public_suffix (2.0.5)
pundit (0.3.0)
activesupport (>= 3.0.0)
raabro (1.1.6)
rack (1.6.10)
rack-protection (2.0.1)
rack
Expand Down Expand Up @@ -324,8 +327,6 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
rubyzip (1.2.1)
rufus-scheduler (3.4.2)
et-orbi (~> 1.0)
sass (3.4.21)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
Expand All @@ -345,8 +346,8 @@ GEM
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
redis (>= 3.3.5, < 5)
sidekiq-cron (0.6.3)
rufus-scheduler (>= 3.3.0)
sidekiq-cron (1.0.4)
fugit (~> 1.1)
sidekiq (>= 4.2.1)
simple_form (3.1.0)
actionpack (~> 4.0)
Expand Down Expand Up @@ -389,8 +390,6 @@ GEM
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
whenever (0.9.4)
chronic (>= 0.6.3)
xpath (3.0.0)
nokogiri (~> 1.8)

Expand Down Expand Up @@ -438,18 +437,16 @@ DEPENDENCIES
rollbar (= 2.8.3)
rspec-rails (~> 3.7.2)
rubocop (~> 0.52.1)
rufus-scheduler (~> 3.4.2)
sass-rails (~> 5.0.7)
select2-rails
shoulda-matchers (~> 3.1.2)
sidekiq (= 5.1.3)
sidekiq-cron (= 0.6.3)
sidekiq-cron (~> 1.0.4)
simple_form (>= 3.0.0)
skylight
uglifier (= 2.7.2)
unicorn
web-console (= 2.1.3)
whenever

RUBY VERSION
ruby 2.3.0p0
Expand Down
12 changes: 12 additions & 0 deletions app/jobs/organization_notifier_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class OrganizationNotifierJob < ActiveJob::Base
queue_as :cron

def perform
Organization.all.find_each do |org|
posts = org.posts.active.of_active_members.from_last_week
if posts.present?
OrganizationNotifier.recent_posts(posts).deliver_later
end
end
end
end
Empty file removed app/mailers/.gitkeep
Empty file.
Empty file removed app/mailers/.keep
Empty file.
14 changes: 0 additions & 14 deletions app/services/organization_notifier_service.rb

This file was deleted.

16 changes: 0 additions & 16 deletions bin/whenever

This file was deleted.

34 changes: 0 additions & 34 deletions config/schedule.rb

This file was deleted.

4 changes: 4 additions & 0 deletions config/schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
weekly_digest:
cron: '0 9 * * 1' # every monday at 9am
class: 'OrganizationNotifierJob'
queue: cron

0 comments on commit 762b473

Please sign in to comment.