fork instead of Thread.new

This commit is contained in:
Sami Samhuri 2015-05-11 23:27:41 -07:00
parent 4787bd8206
commit 3520059ff7

View file

@ -100,7 +100,7 @@ after do
if @wait_for_compilation if @wait_for_compilation
compile.call compile.call
else else
Thread.new &compile fork &compile
end end
end end
@ -124,7 +124,7 @@ post '/publish' do
return 'forbidden' return 'forbidden'
end end
Thread.new do fork do
blog.publish(@fields['env']) blog.publish(@fields['env'])
end end
status 204 status 204
@ -210,7 +210,7 @@ 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)
Thread.new do fork do
blog.publish(@fields['env']) blog.publish(@fields['env'])
end end
@wait_for_compilation = false @wait_for_compilation = false