Skip to content

Commit 660a9b0

Browse files
committed
Add a CLI command to delete expired session files
Updates: #1999 Updates: #8355
1 parent 5ee33cf commit 660a9b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

web/setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from pgadmin import create_app
4343
from pgadmin.utils import clear_database_servers, dump_database_servers, \
4444
load_database_servers, _handle_error
45+
from pgadmin.utils.session import cleanup_session_files
4546
from pgadmin.setup import db_upgrade, create_app_data_directory
4647
from typing import Optional, List
4748
from typing_extensions import Annotated
@@ -636,6 +637,16 @@ def run_migration_for_others():
636637
run_migration_for_sqlite()
637638

638639

640+
class ManageSessions:
641+
642+
@app.command()
643+
def cleanup_session_files():
644+
"""Delete expired session files."""
645+
app = create_app(config.APP_NAME + '-cli')
646+
with app.app_context():
647+
cleanup_session_files()
648+
649+
639650
def main():
640651
app()
641652

0 commit comments

Comments
 (0)