no agotar las conexiones

This commit is contained in:
f 2019-09-18 16:28:30 -03:00
parent 536bf78220
commit 878093d856
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D

View file

@ -3,21 +3,23 @@
# Realiza el deploy de un sitio
class DeployJob < ApplicationJob
def perform(site)
site = Site.find(site)
site.update_attribute :status, 'building'
# Asegurarse que DeployLocal sea el primero!
deployed = { deploy_local: deploy_local(site) }
ActiveRecord::Base.connection_pool.with_connection do
site = Site.find(site)
site.update_attribute :status, 'building'
# Asegurarse que DeployLocal sea el primero!
deployed = { deploy_local: deploy_local(site) }
# No es opcional
unless deployed[:deploy_local]
site.update_attribute :status, 'waiting'
raise
end
deploy_others site, deployed
notify_usuaries site, deployed
# No es opcional
unless deployed[:deploy_local]
site.update_attribute :status, 'waiting'
raise
end
deploy_others site, deployed
notify_usuaries site, deployed
site.update_attribute :status, 'waiting'
end
private