-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Hey guys,
We're having some issues not specifically related to render_anywhere but you may be able to shed some light on them.
In our rails 3.2 app, we're using a Sidekiq job for refreshing cache on the background, below is the snippet for the base class and one of the workers:
require 'render_anywhere'
module CacheRenderer
class Base
include Sidekiq::Worker
include RenderAnywhere
end
end
# ------------------------------------
module CacheRenderer
class RecentEventRsvps < Base
#do not enqueue a rendering job more than once for the same petition over a 2 minute period
sidekiq_options unique: true, unique_job_expiration: 2 * 60
def perform(event_id)
event = Event.find(event_id)
content_to_cache = render(partial: 'shared/attendees_carousel', locals: { ... })
Rails.cache.write(['recent_event_rsvps', event.cache_key], content_to_cache)
end
end
end
Now this is rendered just fine in development, where assets are not precompiled, but in other environments a AssetNotPrecompiledError exception is risen for an image referenced from an image_tag. Doing some debugging we found that Rails.application.config.assets.digests is nil when the job is ran. Assets are synced to S3 using asset_sync.
Have you ever seen this kind of issues? Do you know if we need to perform any manual initialization for sprockets on the sidekiq job?
Thanks in advance,
Diego.