Skip to content

Commit 1b08d24

Browse files
committed
Merge pull request #321 from RickyCook/db-instability
Db instability
2 parents 2bb77a9 + 39601b2 commit 1b08d24

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

dockci/handlers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
import jwt
77
import rollbar
88

9-
from flask import abort, flash, redirect, request, request_finished, Response
9+
from flask import (abort,
10+
flash,
11+
got_request_exception,
12+
redirect,
13+
request,
14+
request_finished,
15+
Response,
16+
)
1017
from flask_login import login_url
1118
from flask_security.utils import verify_and_update_password
1219

@@ -161,6 +168,7 @@ def try_basic_auth():
161168
)
162169

163170

171+
@got_request_exception.connect
164172
@request_finished.connect
165173
def db_rollback(*args, **kwargs): # pylint:disable=unused-argument
166174
""" Rollback the DB transaction when the request completes """

dockci/views/job.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ def job_new_view(project_slug):
5757

5858
if request.headers['X-Github-Event'] == 'push':
5959
push_data = request.json
60+
61+
# Ref deletion
62+
if push_data['head_commit'] is None:
63+
abort(200)
64+
6065
job.commit = push_data['head_commit']['id']
6166

6267
ref_type, ref_name = parse_ref(push_data['ref'])

0 commit comments

Comments
 (0)