- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
def checkTimeEvents(logger):
db = application.db.connect()
cur = db.cursor()
try:
cur.execute("SELECT id_event FROM public.events WHERE time_to_live < now()")
if cur.rowcount != 0:
id_event_row = cur.fetchall()
for id_event in id_event_row:
cur.execute("DELETE FROM public.events WHERE id_event = %(id_event)s", {"id_event" : id_event[0]})
db.commit()
except Exception as e:
db.rollback()
logger.info(str(e))
finally:
db.close()
Комментарии (0) RSS
Добавить комментарий