wip: sqlite wal#164
Conversation
There was a problem hiding this comment.
Code Review
This pull request configures SQLite to use Write-Ahead Logging (WAL) mode and sets the synchronous pragma to NORMAL for improved performance. It also introduces a configurable busy timeout for SQLite connections. Feedback includes removing a debug print statement in the settings file to prevent potential sensitive information disclosure and using float values for the timeout setting to allow for more granular control.
| DATABASES = {'default': default_db_config} | ||
| print(DATABASES) |
There was a problem hiding this comment.
The print(DATABASES) statement should be removed. Printing the database configuration to standard output can leak sensitive information, such as database credentials (username/password) or internal file paths, into application logs. This is especially risky if the environment is ever switched to a production-grade database like PostgreSQL via environment variables.
| DATABASES = {'default': default_db_config} | |
| print(DATABASES) | |
| DATABASES = {'default': default_db_config} |
|
|
||
| if default_db_config.get('ENGINE') == 'django.db.backends.sqlite3': | ||
| default_db_config.setdefault('OPTIONS', {}) | ||
| default_db_config['OPTIONS']['timeout'] = int(os.environ.get('SQLITE_BUSY_TIMEOUT', 20)) |
There was a problem hiding this comment.
Consider using float() instead of int() for the timeout and using setdefault to avoid overwriting values potentially provided in the database URL. SQLite's timeout parameter (passed to sqlite3.connect) supports fractional seconds, and using float provides more flexibility for fine-tuning the busy timeout.
| default_db_config['OPTIONS']['timeout'] = int(os.environ.get('SQLITE_BUSY_TIMEOUT', 20)) | |
| default_db_config['OPTIONS'].setdefault('timeout', float(os.environ.get('SQLITE_BUSY_TIMEOUT', 20))) |
No description provided.