Browse Source
* Schedule data export tasks in sidekiq-cron - Split combined XML and CSV data jobs into seperate background jobs - Add sidekiq-cron to the project - Schedule new XML and CSV jobs to run every day at 5am - Adjust data export Rake tasks to use new job * Add specs for DataExport{Xml,Csv}Job * x * Run bundle install * Change review app export bucket name --------- Co-authored-by: Kat <katrina@kosiak.co.uk>pull/1256/head
James Rose
2 years ago
committed by
GitHub
12 changed files with 113 additions and 29 deletions
@ -1,2 +1,3 @@
|
||||
web: bin/rails server -p 3000 |
||||
redis: redis-server |
||||
js: yarn build --watch |
||||
|
@ -0,0 +1,10 @@
|
||||
class DataExportCsvJob < ApplicationJob |
||||
queue_as :default |
||||
|
||||
def perform |
||||
storage_service = Storage::S3Service.new(Configuration::PaasConfigurationService.new, ENV["EXPORT_PAAS_INSTANCE"]) |
||||
export_service = Exports::LettingsLogExportService.new(storage_service) |
||||
|
||||
export_service.export_csv_lettings_logs |
||||
end |
||||
end |
@ -0,0 +1,10 @@
|
||||
class DataExportXmlJob < ApplicationJob |
||||
queue_as :default |
||||
|
||||
def perform(full_update: false) |
||||
storage_service = Storage::S3Service.new(Configuration::PaasConfigurationService.new, ENV["EXPORT_PAAS_INSTANCE"]) |
||||
export_service = Exports::LettingsLogExportService.new(storage_service) |
||||
|
||||
export_service.export_xml_lettings_logs(full_update:) |
||||
end |
||||
end |
@ -0,0 +1,8 @@
|
||||
data_export_csv: |
||||
cron: "every day at 5am" |
||||
class: "DataExportCsvJob" |
||||
queue: default |
||||
data_export_xml: |
||||
cron: "every day at 5am" |
||||
class: "DataExportXmlJob" |
||||
queue: default |
@ -0,0 +1,19 @@
|
||||
require "rails_helper" |
||||
|
||||
describe DataExportCsvJob do |
||||
let(:storage_service) { instance_double(Storage::S3Service) } |
||||
let(:paas_config_service) { instance_double(Configuration::PaasConfigurationService) } |
||||
let(:export_service) { instance_double(Exports::LettingsLogExportService) } |
||||
|
||||
before do |
||||
allow(Storage::S3Service).to receive(:new).and_return(storage_service) |
||||
allow(Configuration::PaasConfigurationService).to receive(:new).and_return(paas_config_service) |
||||
allow(Exports::LettingsLogExportService).to receive(:new).and_return(export_service) |
||||
end |
||||
|
||||
it "calls the export service" do |
||||
expect(export_service).to receive(:export_csv_lettings_logs) |
||||
|
||||
described_class.perform_now |
||||
end |
||||
end |
@ -0,0 +1,27 @@
|
||||
require "rails_helper" |
||||
|
||||
describe DataExportXmlJob do |
||||
let(:storage_service) { instance_double(Storage::S3Service) } |
||||
let(:paas_config_service) { instance_double(Configuration::PaasConfigurationService) } |
||||
let(:export_service) { instance_double(Exports::LettingsLogExportService) } |
||||
|
||||
before do |
||||
allow(Storage::S3Service).to receive(:new).and_return(storage_service) |
||||
allow(Configuration::PaasConfigurationService).to receive(:new).and_return(paas_config_service) |
||||
allow(Exports::LettingsLogExportService).to receive(:new).and_return(export_service) |
||||
end |
||||
|
||||
it "calls the export service" do |
||||
expect(export_service).to receive(:export_xml_lettings_logs) |
||||
|
||||
described_class.perform_now |
||||
end |
||||
|
||||
context "with full update enabled" do |
||||
it "calls the export service" do |
||||
expect(export_service).to receive(:export_xml_lettings_logs).with(full_update: true) |
||||
|
||||
described_class.perform_now(full_update: true) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue