use harp server for preview and use threads instead of forking

This commit is contained in:
Sami Samhuri 2016-04-11 22:04:22 -07:00
parent 7231c7465b
commit fc3c00687c

View file

@ -16,7 +16,7 @@ CONFIG_DEFAULTS = {
port: 6706, port: 6706,
external_port: 6706, external_port: 6706,
external_ssl: false, external_ssl: false,
preview_port: 5000, preview_port: 9000,
preview_ssl: false, preview_ssl: false,
} }
@ -112,7 +112,7 @@ after do
if @wait_for_compilation if @wait_for_compilation
compile.call compile.call
else else
fork(&compile) Thread.new(&compile)
end end
end end
@ -218,10 +218,10 @@ post '/posts/drafts' do
id, title, body, link = @fields.values_at('id', 'title', 'body', 'link') id, title, body, link = @fields.values_at('id', 'title', 'body', 'link')
begin begin
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 env = @fields['env']
post = blog.publish_post(post) post = blog.publish_post(post)
fork do Thread.new do
blog.publish(@fields['env']) blog.publish(env)
end end
@wait_for_compilation = false @wait_for_compilation = false
end end