Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: Increase database disk pre-allocation

NTFSvolume6381671c04fa
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a6d5e1aa..e19dfede0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,8 +26,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
-- In interactive mode, create `URLs.txt` if it does not exists
+- In interactive mode, automatically create `--input-file` on first use if it does not exists. Defaults to `URLs.txt` if not provided
- Use binary units instead of decimal units for file sizes
+- Increased database disk pre-allocation from 100 MiB to 250 MiB
## [10.0.0] - 2026-06-28
diff --git a/cyberdrop_dl/database/_db.py b/cyberdrop_dl/database/_db.py
index 01063943d..f31179d75 100644
--- a/cyberdrop_dl/database/_db.py
+++ b/cyberdrop_dl/database/_db.py
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Self
from cyberdrop_dl import aio
-from .common import pre_allocate_100mb, raw_connect
+from .common import pre_allocate_250mb, raw_connect
from .hash import HashTable
from .history import HistoryTable
from .schema import SchemaTable
@@ -49,7 +49,7 @@ class Database:
await self.schema.create()
if not self.is_new:
self.schema.check_version()
- await pre_allocate_100mb(self.conn)
+ await pre_allocate_250mb(self.conn)
await self.history.create()
await self.hash.create()
if self.is_new:
diff --git a/cyberdrop_dl/database/common.py b/cyberdrop_dl/database/common.py
index 341dbc378..1c6cf55b5 100644
--- a/cyberdrop_dl/database/common.py
+++ b/cyberdrop_dl/database/common.py
@@ -46,8 +46,8 @@ async def connect(path: Path) -> AsyncGenerator[aiosqlite.Connection]:
await db_conn.close()
-async def pre_allocate_100mb(db_conn: aiosqlite.Connection) -> None:
- """Pre-allocate 100MB of space to the SQL file just in case the user runs out of disk space."""
+async def pre_allocate_250mb(db_conn: aiosqlite.Connection) -> None:
+ """Pre-allocate 250MB of space to the SQL file just in case the user runs out of disk space."""
cursor = await db_conn.execute("PRAGMA freelist_count;")
free_space = await cursor.fetchone()
@@ -58,7 +58,7 @@ async def pre_allocate_100mb(db_conn: aiosqlite.Connection) -> None:
pre_allocate_script = (
"CREATE TABLE IF NOT EXISTS t(x);"
- "INSERT INTO t VALUES(zeroblob(100*1024*1024));" # 100 MB
+ "INSERT INTO t VALUES(zeroblob(250*1024*1024));" # 250 MiB
"DROP TABLE t;"
)
_ = await db_conn.executescript(pre_allocate_script)
diff --git a/tests/test_database.py b/tests/test_database.py
index cdeac31c2..f455c2f4e 100644
--- a/tests/test_database.py
+++ b/tests/test_database.py
@@ -114,11 +114,11 @@ async def test_pre_allocation(tmp_cwd: Path) -> None:
assert size == 0
async with common.connect(db_file) as db:
- await common.pre_allocate_100mb(db)
+ await common.pre_allocate_250mb(db)
size = await aio.get_size(db_file)
assert size
- assert size >= 100e6
+ assert size >= 250e6
async def test_database_version_check(tmp_cwd: Path) -> None: