1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00
This commit is contained in:
carbotaniuman 2022-02-16 23:55:56 -06:00
parent 8cc74ca8e1
commit 5bc05836b3
2 changed files with 16 additions and 12 deletions

View file

@ -59,7 +59,7 @@ class ImageStorage(
private val cacheDirectory: Path,
private val database: Database,
autoPrune: Boolean = true
): AutoCloseable {
) : AutoCloseable {
private val tempCacheDirectory = cacheDirectory.resolve("tmp")
private val evictor: ScheduledExecutorService = Executors.newScheduledThreadPool(2)

View file

@ -39,12 +39,14 @@ class ImageStorageTest : FreeSpec() {
override fun isolationMode() = IsolationMode.InstancePerTest
init {
val imageStorage = autoClose(ImageStorage(
maxSize = 5,
cacheDirectory = tempdir().toPath(),
database = Database.connect("jdbc:sqlite:${tempfile()}"),
autoPrune = false,
))
val imageStorage = autoClose(
ImageStorage(
maxSize = 5,
cacheDirectory = tempdir().toPath(),
database = Database.connect("jdbc:sqlite:${tempfile()}"),
autoPrune = false,
)
)
val testMeta = ImageMetadata("a", "a", 123)
@ -158,11 +160,13 @@ class ImageStorageSlowTest : FreeSpec() {
override fun isolationMode() = IsolationMode.InstancePerTest
init {
val imageStorage = autoClose(ImageStorage(
maxSize = 4097,
cacheDirectory = tempdir().toPath(),
database = Database.connect("jdbc:sqlite:${tempfile()}"),
))
val imageStorage = autoClose(
ImageStorage(
maxSize = 4097,
cacheDirectory = tempdir().toPath(),
database = Database.connect("jdbc:sqlite:${tempfile()}"),
)
)
"autoPrune" - {
"should update size eventually" {