From 32ce4cc2dff7e40b26ea474af9f127ef127a3052 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Tue, 11 Dec 2018 16:01:53 +0500 Subject: [PATCH] Add RavenJob --- app/jobs/raven_job.rb | 9 +++++++++ config/initializers/raven.rb | 1 + spec/jobs/raven_job_spec.rb | 7 +++++++ 3 files changed, 17 insertions(+) create mode 100644 app/jobs/raven_job.rb create mode 100644 spec/jobs/raven_job_spec.rb diff --git a/app/jobs/raven_job.rb b/app/jobs/raven_job.rb new file mode 100644 index 0000000..890a992 --- /dev/null +++ b/app/jobs/raven_job.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class RavenJob < ApplicationJob + queue_as :default + + def perform(event) + Raven.send_event event + end +end diff --git a/config/initializers/raven.rb b/config/initializers/raven.rb index 2a09d8d..0f11538 100644 --- a/config/initializers/raven.rb +++ b/config/initializers/raven.rb @@ -3,6 +3,7 @@ # Be sure to restart your server when you modify this file. Raven.configure do |config| + config.async = RavenJob.method :perform_later config.current_environment = Rails.env config.dsn = Rails.application.credentials.raven_dsn config.environments = %w[production] diff --git a/spec/jobs/raven_job_spec.rb b/spec/jobs/raven_job_spec.rb new file mode 100644 index 0000000..3de6caf --- /dev/null +++ b/spec/jobs/raven_job_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe RavenJob do + pending "add some examples to (or delete) #{__FILE__}" +end