##// END OF EJS Templates
pull-requests: updated use lower retry, and cleanup some code
super-admin -
r4711:2406d9fc stable
parent child Browse files
Show More
@@ -1269,6 +1269,9 b' class RepoPullRequestsView(RepoAppView, '
1269 1269
1270 1270 c = self.load_default_context()
1271 1271 redirect_url = None
1272 # we do this check as first, because we want to know ASAP in the flow that
1273 # pr is updating currently
1274 is_state_changing = pull_request.is_state_changing()
1272 1275
1273 1276 if pull_request.is_closed():
1274 1277 log.debug('update: forbidden because pull request is closed')
@@ -1277,7 +1280,6 b' class RepoPullRequestsView(RepoAppView, '
1277 1280 return {'response': True,
1278 1281 'redirect_url': redirect_url}
1279 1282
1280 is_state_changing = pull_request.is_state_changing()
1281 1283 c.pr_broadcast_channel = channelstream.pr_channel(pull_request)
1282 1284
1283 1285 # only owner or admin can update it
@@ -1286,7 +1288,8 b' class RepoPullRequestsView(RepoAppView, '
1286 1288
1287 1289 if allowed_to_update:
1288 1290 controls = peppercorn.parse(self.request.POST.items())
1289 force_refresh = str2bool(self.request.POST.get('force_refresh'))
1291 force_refresh = str2bool(self.request.POST.get('force_refresh', 'false'))
1292 do_update_commits = str2bool(self.request.POST.get('update_commits', 'false'))
1290 1293
1291 1294 if 'review_members' in controls:
1292 1295 self._update_reviewers(
@@ -1300,7 +1303,7 b' class RepoPullRequestsView(RepoAppView, '
1300 1303 pull_request, controls['observer_members'],
1301 1304 pull_request.reviewer_data,
1302 1305 PullRequestReviewers.ROLE_OBSERVER)
1303 elif str2bool(self.request.POST.get('update_commits', 'false')):
1306 elif do_update_commits:
1304 1307 if is_state_changing:
1305 1308 log.debug('commits update: forbidden because pull request is in state %s',
1306 1309 pull_request.pull_request_state)
@@ -1353,8 +1356,9 b' class RepoPullRequestsView(RepoAppView, '
1353 1356
1354 1357 def _update_commits(self, c, pull_request):
1355 1358 _ = self.request.translate
1359 log.debug('pull-request: running update commits actions')
1356 1360
1357 @retry(exception=Exception, n_tries=3)
1361 @retry(exception=Exception, n_tries=3, delay=2)
1358 1362 def commits_update():
1359 1363 return PullRequestModel().update_commits(
1360 1364 pull_request, self._rhodecode_db_user)
General Comments 0
You need to be logged in to leave comments. Login now