publish in the background

This commit is contained in:
Sami Samhuri 2015-05-11 21:25:04 -07:00
parent 7a2338de6b
commit d02adf6b31

View file

@ -124,7 +124,9 @@ post '/publish' do
return 'forbidden' return 'forbidden'
end end
blog.publish(@fields['env']) Thread.new do
blog.publish(@fields['env'])
end
status 204 status 204
end end
@ -208,7 +210,10 @@ post '/posts/drafts' do
if post = blog.create_post(title, body, link, id: id, draft: true) if post = blog.create_post(title, body, link, id: id, draft: true)
if @fields['env'] if @fields['env']
post = blog.publish_post(post) post = blog.publish_post(post)
blog.publish(@fields['env']) Thread.new do
blog.publish(@fields['env'])
end
@wait_for_compilation = false
end end
url = url_for(post.url) url = url_for(post.url)
status 201 status 201