##// END OF EJS Templates
pull-requests: optimize db transaction logic....
super-admin -
r4712:412d5d47 stable
parent child Browse files
Show More
@@ -261,7 +261,6 b' def store(action, user, action_data=None'
261 261 ip_address = safe_unicode(ip_addr)
262 262
263 263 with sa_session.no_autoflush:
264 update_user_last_activity(sa_session, user_id)
265 264
266 265 user_log = _store_log(
267 266 action_name=action_name,
@@ -275,11 +274,15 b' def store(action, user, action_data=None'
275 274 )
276 275
277 276 sa_session.add(user_log)
277 if commit:
278 sa_session.commit()
279 entry_id = user_log.entry_id or ''
280
281 update_user_last_activity(sa_session, user_id)
278 282
279 283 if commit:
280 284 sa_session.commit()
281 285
282 entry_id = user_log.entry_id or ''
283 286 log.info('AUDIT[%s]: Logging action: `%s` by user:id:%s[%s] ip:%s',
284 287 entry_id, action_name, user_id, username, ip_address)
285 288
@@ -295,4 +298,6 b' def update_user_last_activity(sa_session'
295 298 log.debug(
296 299 'updated user `%s` last activity to:%s', user_id, _last_activity)
297 300 except Exception:
298 log.exception("Failed last activity update")
301 log.exception("Failed last activity update for user_id: %s", user_id)
302 sa_session.rollback()
303
@@ -1198,14 +1198,20 b' class PullRequestModel(BaseModel):'
1198 1198 pull_request=pull_request,
1199 1199 revision=commit_id)
1200 1200
1201 # initial commit
1202 Session().commit()
1203
1204 if pr_has_changes:
1201 1205 # send update email to users
1202 1206 try:
1203 1207 self.notify_users(pull_request=pull_request, updating_user=updating_user,
1204 1208 ancestor_commit_id=ancestor_commit_id,
1205 1209 commit_changes=commit_changes,
1206 1210 file_changes=file_changes)
1211 Session().commit()
1207 1212 except Exception:
1208 1213 log.exception('Failed to send email notification to users')
1214 Session().rollback()
1209 1215
1210 1216 log.debug(
1211 1217 'Updated pull request %s, added_ids: %s, common_ids: %s, '
@@ -1221,7 +1227,7 b' class PullRequestModel(BaseModel):'
1221 1227 pull_request.pull_request_id, source_ref_id,
1222 1228 pull_request.source_ref_parts.commit_id,
1223 1229 pull_request_version.pull_request_version_id)
1224 Session().commit()
1230
1225 1231 self.trigger_pull_request_hook(pull_request, pull_request.author, 'update')
1226 1232
1227 1233 return UpdateResponse(
General Comments 0
You need to be logged in to leave comments. Login now