Skip to content

Delay upon start-up when looking for stale databases to remove #2

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

Closed
code-distortion opened this issue Jun 21, 2022 · 1 comment
Closed

Comments

@code-distortion
Copy link
Owner

Description:

When Adapt starts, before building databases, it checks for stale databases to remove. It does this by looping through the present connections, and checking the databases within. However these connections can time-out, adding a delay to the test-process.

This is particularly prevalent when using a PostgreSQL database, because the way Laravel's config is set up means that the (unused) MySQL connection exists, but with the PostgreSQL server's details. Adapt then tries to connect to the PostgreSQL server with the MyQSL client, and this particular combination takes 1 minute before timing out.

Logs:

[2022-06-21 14:22:12] testing.DEBUG: ADAPT: Looking for stale things to remove  
[2022-06-21 14:22:12] testing.DEBUG: ADAPT: Generated a content-based build-source checksum (0ms)  
[2022-06-21 14:22:12] testing.DEBUG: ADAPT: Retrieved database list (connection: "sqlite", driver: "sqlite") (0ms)  
[2022-06-21 14:22:12] testing.DEBUG: ADAPT: - No databases were found (0ms)  
[2022-06-21 14:23:12] testing.WARNING: ADAPT: Could not retrieve database list (connection: "mysql", driver: "mysql") (1m)  
[2022-06-21 14:23:12] testing.DEBUG: ADAPT: Retrieved database list (connection: "pgsql", driver: "pgsql") (13ms)  
[2022-06-21 14:23:12] testing.DEBUG: ADAPT: - Found database "db_484a0c_399f58dcb9c0" (usable) (7ms)  
[2022-06-21 14:23:12] testing.WARNING: ADAPT: Could not retrieve database list (connection: "sqlsrv", driver: "sqlsrv") (1ms)  
[2022-06-21 14:23:12] testing.DEBUG: ADAPT: Retrieved snapshot list (0ms)  
[2022-06-21 14:23:12] testing.DEBUG: ADAPT: - Found snapshot "/var/www/html/database/adapt-test-storage/snapshots/snapshot.db.484a0c-33d736a4f21d.pgsql" (usable) (0ms)  
[2022-06-21 14:23:12] testing.DEBUG: ADAPT: - Found snapshot "/var/www/html/database/adapt-test-storage/snapshots/snapshot.db.484a0c-a858496f4d3b.pgsql" (usable) (0ms)  
[2022-06-21 14:23:12] testing.DEBUG: ADAPT: Nothing found to remove - total time taken (1m)

…
@code-distortion
Copy link
Owner Author

I have addressed this problem by getting Adapt to only look for stale databases via connections that are being prepared.

This way, if you only use the pgsql connection for example, it won't search using the mysql connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant