Commit 6e4b9d5b authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

Cleanup by batches

parent a9810e97
......@@ -153,20 +153,19 @@ def cleanup():
raise e
cur.execute("select user_index,login from users where expires_at < now();")
users = cur.fetchall()
for uidx in users:
logging.debug(uidx)
try:
for users in cur.fetchmany(1000):
logging.info("Deleting %s/%s old logins"%(len(users), cur.rowcount ))
try :
cur.execute("""
delete from credentials where user_index = %s
""", [uidx[0]] )
delete from credentials where user_index in (%s)
""", ','.join([u[0] for u in users]))
cur.execute("""
delete from users where user_index = %s;
""", [uidx[0]] )
delete from users where user_index in (%s)
""", ','.join([u[0] for u in users]))
except Exception as e:
logging.error("Unable de delete from credentials or users")
logging.error(e)
conn.commit()
conn.commit()
conn.close()
try:
......
__version__='0.2.0'
__version__='0.2.1'
from io import open
from setuptools import setup, find_packages
with open('eidawsauth/version.py', 'r') as f:
for line in f:
if line.startswith('__version__'):
version = line.strip().split('=')[1].strip(' \'"')
break
else:
version = '0.0.1'
from eidawsauth.version import __version__
with open('README.md', 'r', encoding='utf-8') as f:
readme = f.read()
setup(
name='eidawsauth',
version=version,
version=__version__,
description='Implement /auth for EIDA',
long_description=readme,
long_description_content_type="text/markdown",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment