From bcee95214ecb0bc7a9da51f6b7a3a3b339345c73 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Mon, 27 Nov 2017 13:46:39 +0000 Subject: [PATCH] Add sleep after stopping the old app instances on deploy sleep for 10 seconds to try and make sure that all worker threads (either web api or celery) have finished before we delete when we delete the DB is unbound from the app, which can cause "permission denied for relation" psycopg2 errors. --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 8ac0f2429..b4a03d2eb 100644 --- a/Makefile +++ b/Makefile @@ -277,6 +277,10 @@ cf-deploy: ## Deploys the app to Cloud Foundry cf rename ${CF_APP} ${CF_APP}-rollback cf push ${CF_APP} -f ${CF_MANIFEST_FILE} cf scale -i $$(cf curl /v2/apps/$$(cf app --guid ${CF_APP}-rollback) | jq -r ".entity.instances" 2>/dev/null || echo "1") ${CF_APP} + cf stop ${CF_APP}-rollback + # sleep for 10 seconds to try and make sure that all worker threads (either web api or celery) have finished before we delete + # when we delete the DB is unbound from the app, which can cause "permission denied for relation" psycopg2 errors. + sleep 10 cf delete -f ${CF_APP}-rollback .PHONY: cf-deploy-api-db-migration