Skip to content

Commit be64911

Browse files
Update controllers.py
Deleting instances requires a db, so do this at the correct point
1 parent 4ced84e commit be64911

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mod_ci/controllers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,16 @@ def start_platforms(repository, delay=None, platform=None) -> None:
102102
log.critical('GCP project name is empty!')
103103
return
104104

105-
compute = get_compute_service_object()
106-
delete_expired_instances(compute, vm_max_runtime, project, zone)
107-
108105
with app.app_context():
109106
from flask import current_app
110107
app = current_app._get_current_object()
111108

112109
# Create a database session
113110
db = create_session(config.get('DATABASE_URI', ''))
114111

112+
compute = get_compute_service_object()
113+
delete_expired_instances(compute, vm_max_runtime, project, zone)
114+
115115
if platform is None or platform == TestPlatform.linux:
116116
log.info('Define process to run Linux GCP instances')
117117
gcp_instance(app, db, TestPlatform.linux, repository, delay)

0 commit comments

Comments
 (0)