Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup of PgAdmin/PgAdmin4 is slow when DATA_DIR is redirected to another location in Windows #8141

Open
rhewy opened this issue Nov 16, 2024 · 3 comments
Assignees
Labels

Comments

@rhewy
Copy link

rhewy commented Nov 16, 2024

Describe the bug

Although the DATA_DIR redirect eventually works, PgAdmin is busy initializing directories and files in %USERPROFILE% before the redirection happens. The location in %USERPROFILE% is not used after the redirect. On a restart of PgAdmin within in the same session the apps launches at a reasonable speed. The initialization of dirs and files happens twice on a new/clean login.

To Reproduce

Steps to reproduce the behavior:

  1. Install PgAdmin4 on Windows
  2. Redirect the DATA_DIR in config.py
if IS_WIN:
    # Use the short path on windows
    DATA_DIR = os.path.realpath(
        os.path.join(fs_short_path('H:'), APP_WIN_PATH)
    )
  1. Check %USERPROFILE% for PgAdmin4
  2. Check the redirected directory for PgAdmin

The directories have slightly different names BTW

Expected behavior

If a redirect is valid, then directories and files should not be created in %USERPROFILE% and the settings directory should have the same name.

Error message
There is no error message on a good run, just a delayed startup. However, occasionally It does take too long and PgAdmin gives up on staring.
image

Screenshots
Config.py
image

%USERPROFILE%
image

DATA_DIR
image

Desktop Info:

  • OS: Windows 11
  • Version: Microsoft Windows [Version 10.0.22631.4169]
  • Mode: Apporto Desktop (cloud desktop)
  • Browser NA
  • Package type: Download from PgAdmin website (windows 8.13)

Additional context
The profiles are not Roaming or 100% Roaming and we have to redirect the app settings to a more permanent location. If there is a better way let me know. This could also be a feature request where settings could be stored in in a different location for a user e.g a home drive that is separate from c:\users.

@rhewy rhewy added the Bug label Nov 16, 2024
@adityatoshniwal
Copy link
Contributor

Hi @rhewy,

There will be two directories here:

  1. pgAdmin config data and logs. (DATA_DIR)
  2. Cache directory created by the Electron container which wraps pgAdmin for desktop.

It is completely safe to remove the 2nd (electron) directory as it is just a cache and will be re-created. But the 1st directory(DATA_DIR) will have your server config and other pgAdmin settings. You'll lose if you remove that dir.

@rhewy
Copy link
Author

rhewy commented Nov 19, 2024

Is there any way to prevent the files and directories (pgAdmin/pgAdmin4) from being recreated/reinitialized in %USERPROFILE% if they already exist in DATA_DIR?

@adityatoshniwal
Copy link
Contributor

Is there any way to prevent the files and directories (pgAdmin/pgAdmin4) from being recreated/reinitialized in %USERPROFILE% if they already exist in DATA_DIR?

Unfortunately no, the purpose of both the directories is different as I mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants