Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ GEM
bundler-audit (0.9.3)
bundler (>= 1.2.0)
thor (~> 1.0)
concurrent-ruby (1.3.6)
concurrent-ruby (1.3.7)
connection_pool (3.0.2)
coveralls_reborn (0.29.0)
simplecov (~> 0.22.0)
term-ansicolor (~> 1.7)
thor (~> 1.2)
tins (~> 1.32)
crass (1.0.6)
crass (1.0.7)
date (3.5.1)
debug (1.11.1)
irb (~> 1.10)
Expand All @@ -137,21 +137,21 @@ GEM
elasticsearch-rails (8.0.1)
erb (6.0.4)
erubi (1.13.1)
excon (1.4.2)
excon (1.5.0)
logger
factory_bot (6.6.0)
activesupport (>= 6.1.0)
factory_bot_rails (6.5.1)
factory_bot (~> 6.5)
railties (>= 6.1.0)
faraday (2.14.2)
faraday (2.14.3)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-excon (2.4.0)
excon (>= 1.0.0)
faraday (>= 2.11.0, < 3)
faraday-net_http (3.4.2)
faraday-net_http (3.4.4)
net-http (~> 0.5)
faraday_middleware-aws-sigv4 (1.0.1)
aws-sigv4 (~> 1.0)
Expand All @@ -169,7 +169,7 @@ GEM
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jmespath (1.6.2)
json (2.19.5)
json (2.20.0)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
Expand Down Expand Up @@ -198,13 +198,13 @@ GEM
drb (~> 2.0)
prism (~> 1.5)
mize (0.6.1)
msgpack (1.8.0)
msgpack (1.8.3)
multi_json (1.21.1)
mysql2 (0.5.7)
bigdecimal
net-http (0.9.1)
uri (>= 0.11.1)
net-imap (0.6.4)
net-imap (0.6.4.1)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -214,13 +214,13 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.5)
nokogiri (1.19.3-aarch64-linux-gnu)
nokogiri (1.19.4-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.19.3-arm64-darwin)
nokogiri (1.19.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.19.3-x86_64-linux-gnu)
nokogiri (1.19.4-x86_64-linux-gnu)
racc (~> 1.4)
oj (3.17.1)
oj (3.17.3)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
ostruct (0.6.3)
Expand Down Expand Up @@ -388,7 +388,7 @@ GEM
useragent (0.16.11)
uuid (2.3.9)
macaddr (~> 1.0)
websocket-driver (0.8.0)
websocket-driver (0.8.2)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand Down
39 changes: 39 additions & 0 deletions app/workers/reindex_touched_dois_worker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
class ReindexTouchedDoisWorker
include Shoryuken::Worker

shoryuken_options queue: -> { "#{ENV["RAILS_ENV"]}_events_reindex_daily" }, auto_delete: true

def perform(sqs_message = nil, data = nil)
log_prefix = "[Events:ReindexTouchedDoisWorker]"

date = get_date(data)

Rails.logger.info("#{log_prefix} Starting reindex of DOIs touched on #{date}")

if date.nil?
Rails.logger.error("#{log_prefix} Date was not provided")
return
end

# Reindex touched DOIS
count = Event.reindex_touched_dois(start_date: date, end_date: date)

Rails.logger.info("#{log_prefix} Sent #{count} unique DOIs for re-indexing on #{date}")
end

private

# Will return nil if either data or date field is missing.
def get_date(data)
return if data.blank?

data_hash = JSON.parse(data)
data_hash.dig("data", "date")

begin
Date.parse(date)
rescue
nil
end
end
end
1 change: 1 addition & 0 deletions config/shoryuken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ groups:
concurrency: 95
queues:
- events
- events_reindex_daily
events_index:
concurrency: 95
queues:
Expand Down
4 changes: 2 additions & 2 deletions vendor/docker/shoryuken.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ cd /home/app/webapp
# Redirect stdout and stderr to the same place
exec 2>&1

# Disble starting the queue worker when the environment variable DISABLE_QUEUE_WORKER is set to "true".
# Disable starting the queue worker when the environment variable DISABLE_QUEUE_WORKER is set to "true".
# This value is set in the docker-compose.yml file
if [ "$DISABLE_QUEUE_WORKER" != "true" ]; then
echo "Starting Shoryuken worker"
exec /sbin/setuser app bundle exec shoryuken -R -C config/shoryuken.yml
fi
fi
Loading