close db session per change
This commit is contained in:
parent
f8c09226de
commit
d817c67f83
2 changed files with 7 additions and 7 deletions
|
@ -65,11 +65,12 @@ class Changelog(db.Model):
|
||||||
def apply_changes(cls, user, changes):
|
def apply_changes(cls, user, changes):
|
||||||
trigger = changes
|
trigger = changes
|
||||||
for change in changes:
|
for change in changes:
|
||||||
if not cls.apply_change(user, change, trigger=False):
|
with db.session():
|
||||||
logger.debug('FAIL %s', change)
|
if not cls.apply_change(user, change, trigger=False):
|
||||||
trigger = False
|
logger.debug('FAIL %s', change)
|
||||||
break
|
trigger = False
|
||||||
return False
|
break
|
||||||
|
return False
|
||||||
if trigger:
|
if trigger:
|
||||||
trigger_event('change', {});
|
trigger_event('change', {});
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -297,8 +297,7 @@ class Node(Thread):
|
||||||
return False
|
return False
|
||||||
if not changes:
|
if not changes:
|
||||||
return False
|
return False
|
||||||
with db.session():
|
r = Changelog.apply_changes(self.user, changes)
|
||||||
r = Changelog.apply_changes(self.user, changes)
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def pushChanges(self, changes):
|
def pushChanges(self, changes):
|
||||||
|
|
Loading…
Reference in a new issue