* Dropped all references to Resque * Moved all jobs under app/workers since that's the Sidekiq convention * Renamed Jobs module to Worker to match new location * Adapted all jobs to Sidekiq * Replaced all enqueue calls with perform_async * Dropped Resque hacks from specs and features, replaced with sidekig/testing in RSpec and sidekig/testing/inline in Cucumber * Updated scripts to start a Sidekiq server * Inline Sidekiq sinatra app * Let Sidekiq create the actual Redis instance * Workaround already initialized constant warnings in service models * Resolved ToDo in one job definition by creating proper exception clases for some errors in receiving posts * Added sidekiq section to configuration to make it completly configurable to the user * Add Sidekiq middleware for clean backtraces * Delay HttpMulti retry to give offline pods a chance to come back up * Do not retry on GUID already taken and alike errors * Be graceful about deleted posts in GatherOEmbedData
34 lines
825 B
Ruby
34 lines
825 B
Ruby
class User
|
|
include Rails.application.routes.url_helpers
|
|
def default_url_options
|
|
{:host => AppConfig.pod_uri.host}
|
|
end
|
|
|
|
alias_method :share_with_original, :share_with
|
|
|
|
def share_with(*args)
|
|
inlined_jobs do
|
|
share_with_original(*args)
|
|
end
|
|
end
|
|
|
|
def post(class_name, opts = {})
|
|
inlined_jobs do
|
|
p = build_post(class_name, opts)
|
|
if p.save!
|
|
self.aspects.reload
|
|
|
|
aspects = self.aspects_from_ids(opts[:to])
|
|
add_to_streams(p, aspects)
|
|
dispatch_opts = {:url => post_url(p), :to => opts[:to]}
|
|
dispatch_opts.merge!(:additional_subscribers => p.root.author) if class_name == :reshare
|
|
dispatch_post(p, dispatch_opts)
|
|
end
|
|
unless opts[:created_at]
|
|
p.created_at = Time.now - 1
|
|
p.save
|
|
end
|
|
p
|
|
end
|
|
end
|
|
end
|