pastebinner/workers/paste_to_es.rb

15 lines
554 B
Ruby

class PasteToEs
include Sidekiq::Worker
sidekiq_options retry: false # i dont want to get rate limited so im just letting this fail if their are any failures
def perform(es_object, pb_object, paste_max)
Logger.new(STDOUT).info("PasteToEs started")
# get public pastes and their keys
pastes = pb_object.scrape_public_pastes(paste_max)
keys = pb_object.get_unique_paste_keys(pastes)
# build it into json and send it to elasticsearch
json_data = pb_object.json_paste(keys)
es_object.json_to_es_bulk(json_data)
end
end