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

Code snippet test #400

Open
rauhryan opened this issue Aug 17, 2017 · 3 comments
Open

Code snippet test #400

rauhryan opened this issue Aug 17, 2017 · 3 comments

Comments

@rauhryan
Copy link
Member

class CachedJob < ActiveJob::Base
def perform(params)
Rails.cache.with do |dalli|
uuid = SecureRandom.uuid
if params[:cache_key] && !dalli.get(params[:cache_key])
dalli.set(params[:cache_key], uuid)
end
if dalli.get(params[:cache_key]) === uuid
message = deliver params
return if params[:suppress]
PublishWebhookJob.perform_later message if params[:webhook_publishable]
end
end
end

Please open new issues for HuBoard here
contact support@huboard.com for personal support on critical issues

@dahlbyk
Copy link
Member

dahlbyk commented Aug 17, 2017

Do snippets work in comments, too?

if params[:cache_key] && !dalli.get(params[:cache_key])
dalli.set(params[:cache_key], uuid)
end

@rauhryan
Copy link
Member Author

Ooooohhhh that's nice

@dahlbyk
Copy link
Member

dahlbyk commented Aug 17, 2017

First attempt didn't work because I fat-fingered #L5-7 instead of #L5-L7. Seems like the former could/should reasonably work. 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants