faster changelog rebuild
This commit is contained in:
parent
4691279b3d
commit
fd922cc83c
2 changed files with 16 additions and 10 deletions
|
|
@ -45,7 +45,11 @@ class Changelog(db.Model):
|
|||
sig = sa.Column(sa.String(96))
|
||||
|
||||
@classmethod
|
||||
def record(cls, user, action, *args):
|
||||
def record(cls, user, action, *args, **kwargs):
|
||||
commit = True
|
||||
if '_commit' in kwargs:
|
||||
commit = kwargs['_commit']
|
||||
del kwargs['_commit']
|
||||
c = cls()
|
||||
c.created = datetime.utcnow()
|
||||
c.timestamp = datetime2ts(c.created)
|
||||
|
|
@ -55,7 +59,8 @@ class Changelog(db.Model):
|
|||
_data = str(c.revision) + str(c.timestamp) + c.data
|
||||
_data = _data.encode()
|
||||
state.db.session.add(c)
|
||||
state.db.session.commit()
|
||||
if commit:
|
||||
state.db.session.commit()
|
||||
logger.debug('record change: %s', c.json())
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue