Skip to content

Commit 0cef6ea

Browse files
author
Gabriel Monroy
committed
fix(app): only set initial structure when build hook is triggered
As part of the effort to move code from views into models, we would always scale an app to an initial structure on every deploy. This made it impossible to, for example, set a BUILDPACK_URL without triggering a false deploy and timeout. Moving the logic back into the BuildView where it belongs.
1 parent 88e07d4 commit 0cef6ea

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

api/models.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ def delete(self, *args, **kwargs):
129129

130130
def deploy(self, release):
131131
tasks.deploy_release.delay(self, release).get()
132-
if self.structure == {}:
133-
# scale the web process by 1 initially
134-
self.structure = {'web': 1}
135-
self.save()
136-
self.scale()
137132

138133
def destroy(self, *args, **kwargs):
139134
return self.delete(*args, **kwargs)

api/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ def post_save(self, build, created=False):
344344
if created:
345345
release = build.app.release_set.latest()
346346
self.release = release.new(self.request.user, build=build)
347+
# scale the web process by 1 initially
348+
if build.app.structure == {}:
349+
build.app.structure = {'web': 1}
350+
build.app.save()
347351
build.app.deploy(self.release)
348352

349353
def get_success_headers(self, data):

0 commit comments

Comments
 (0)