Skip to content

Commit

Permalink
[FIX] runbot: reduce serialization failures (TransactionRollbackError)
Browse files Browse the repository at this point in the history
Both the cron and the tests themselves need to write to the builds,
which triggers the update of the `repo_id` field, as it is a stored
related.
  • Loading branch information
odony committed Jan 18, 2016
1 parent db6261e commit 8067425
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion runbot/runbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,18 @@ def _get_domain(self, cr, uid, ids, field_name, arg, context=None):

_columns = {
'branch_id': fields.many2one('runbot.branch', 'Branch', required=True, ondelete='cascade', select=1),
'repo_id': fields.related('branch_id', 'repo_id', type="many2one", relation="runbot.repo", string="Repository", readonly=True, store=True, ondelete='cascade', select=1),
'repo_id': fields.related(
'branch_id', 'repo_id', type="many2one", relation="runbot.repo",
string="Repository", readonly=True, ondelete='cascade', select=1,
store={
'runbot.build': (lambda s, c, u, ids, ctx: ids, ['branch_id'], 20),
'runbot.branch': (
lambda self, cr, uid, ids, ctx: self.pool['runbot.build'].search(
cr, uid, [('branch_id', 'in', ids)]),
['repo_id'],
10,
),
}),
'name': fields.char('Revno', required=True, select=1),
'host': fields.char('Host'),
'port': fields.integer('Port'),
Expand Down

0 comments on commit 8067425

Please sign in to comment.