Ignore RecordDeleted on notification getter

fix #3888
This commit is contained in:
Ruud
2014-09-17 22:51:27 +02:00
parent 76322c0145
commit 4c198f7116
+9 -3
View File
@@ -3,6 +3,7 @@ import threading
import time
import traceback
import uuid
from CodernityDB.database import RecordDeleted
from couchpotato import get_db
from couchpotato.api import addApiView, addNonBlockApiView
@@ -270,11 +271,16 @@ class CoreNotifier(Notification):
if init:
db = get_db()
notifications = db.all('notification', with_doc = True)
notifications = db.all('notification')
for n in notifications:
if n['doc'].get('time') > (time.time() - 604800):
messages.append(n['doc'])
try:
doc = db.get('id', n.get('_id'))
if doc.get('time') > (time.time() - 604800):
messages.append(doc)
except RecordDeleted:
pass
return {
'success': True,