Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve sidekiq errors #121

Closed
wants to merge 7 commits into from
13 changes: 13 additions & 0 deletions app/jobs/content_event_job_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

# OVERRIDE HYRAX 3.4.1 to handle nil case and casue of sidekiq sentry error
# TODO: why is depositor coming across as nil?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From @ShanaLMoore

This may be a temp fix to help reduce the noise of sidekiq sentry error and prevent it from clogging up our limit rate too fast.
However, why would depositor be nil is a Q we should be able to answer.
Consider putting this into its own ticket.
Ref #231

module ContentEventJobDecorator
# OVERRIDE HYRAX 3.4.1 to handle nil case and casue of sidekiq sentry error
# log the event to the users profile stream
def log_user_event(depositor)
depositor&.log_profile_event(event)
end
end

ContentEventJob.prepend(ContentEventJobDecorator)
20 changes: 20 additions & 0 deletions app/services/hyrax/visibility_propagator_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors.
require_dependency Hyrax::Engine.root.join('app', 'services', 'hyrax', 'visibility_propagator').to_s

Hyrax::VisibilityPropagator::NullVisibilityPropogator.class_eval do
## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors.
# @return [void]
# @raise [RuntimeError] if we're in development mode
def propagate
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From @ShanaLMoore :

propogate => propagate

# rubocop:disable Performance/Caller
message = "Tried to propagate visibility to members of #{source} " \
"but didn't know what kind of object it is. Model " \
"name #{source.try(:model_name)}. Called from #{caller[0]}."
# rubocop:enable Performance/Caller

Hyrax.logger.warn(message)
Rails.env.development? ? raise(message) : :noop
end
end