Cleanup after database use
This commit is contained in:
@@ -65,6 +65,7 @@ class CoreNotifier(Notification):
|
||||
q.update({Notif.read: True})
|
||||
|
||||
db.commit()
|
||||
db.close()
|
||||
|
||||
return jsonified({
|
||||
'success': True
|
||||
@@ -90,6 +91,7 @@ class CoreNotifier(Notification):
|
||||
ndict['type'] = 'notification'
|
||||
notifications.append(ndict)
|
||||
|
||||
db.close()
|
||||
return jsonified({
|
||||
'success': True,
|
||||
'empty': len(notifications) == 0,
|
||||
@@ -114,7 +116,8 @@ class CoreNotifier(Notification):
|
||||
ndict['time'] = time.time()
|
||||
self.messages.append(ndict)
|
||||
|
||||
db.remove()
|
||||
db.close()
|
||||
return True
|
||||
|
||||
def frontend(self, type = 'notification', data = {}):
|
||||
self.messages.append({
|
||||
@@ -143,6 +146,8 @@ class CoreNotifier(Notification):
|
||||
ndict['type'] = 'notification'
|
||||
messages.append(ndict)
|
||||
|
||||
db.close()
|
||||
|
||||
self.messages = []
|
||||
return jsonified({
|
||||
'success': True,
|
||||
|
||||
@@ -22,3 +22,6 @@ class History(Notification):
|
||||
)
|
||||
db.add(history)
|
||||
db.commit()
|
||||
db.close()
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user