~craftyguy/ridecasa

9760a42858910832b50991fea19f38a1b3129ab8 — Clayton Craft 3 years ago f52c59a
tasks: add delete_user task for delayed delete

Deleting a user with lots of activities takes a while, since the web
backend blocks until the sql transaction is complete. This adds a task
that can be scheduled later to delete the user
1 files changed, 7 insertions(+), 0 deletions(-)

M ridecasa/tasks/__init__.py
M ridecasa/tasks/__init__.py => ridecasa/tasks/__init__.py +7 -0
@@ 40,6 40,13 @@ def huey_startup():
    init_db(ridecasa.RIDECASA_SQLITE_DB)


@huey.task(priority=0)
@db_session
def delete_user(current_user_id):
    orm.delete(u for u in db.User
               if u.id == current_user_id)


@huey.task(priority=10)
def import_file(filename, current_user_id, overwrite_existing=False):
    app = create_app_huey('ridecasa.config.ProductionConfig')