blob: 2a614663e7e1fb84760d22411c2d62c2e3ea7027 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module Workers
class Base
include Sidekiq::Worker
sidekiq_options backtrace: (bt = AppConfig.environment.sidekiq.backtrace.get) && bt.to_i,
retry: (rt = AppConfig.environment.sidekiq.retry.get) && rt.to_i
# In the long term we need to eliminate the cause of these
def suppress_annoying_errors(&block)
yield
rescue Diaspora::ContactRequiredUnlessRequest,
Diaspora::RelayableObjectWithoutParent,
# Friendica seems to provoke these
Diaspora::AuthorXMLAuthorMismatch,
# We received a private object to our public endpoint, again something
# Friendica seems to provoke
Diaspora::NonPublic,
Diaspora::XMLNotParseable => e
Rails.logger.info("error on receive: #{e.class}")
rescue ActiveRecord::RecordInvalid => e
Rails.logger.info("failed to save received object: #{e.record.errors.full_messages}")
raise e unless %w(
"already been taken"
"is ignored by the post author"
).any? {|reason| e.message.include? reason }
end
private
def logger
@logger ||= ::Logging::Logger[self]
end
end
end
|