mirror of
https://gitlab.com/mangadex-pub/mangadex_at_home.git
synced 2024-01-19 02:48:37 +00:00
Fix various bugs and logs
This commit is contained in:
parent
3812fcab47
commit
a33a1dcc44
|
@ -59,8 +59,9 @@ fun migrate(path: Path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2.from(DbImage).select().asIterable().chunked(1000).forEach { list ->
|
||||||
sqlite.batchInsert(DbImage) {
|
sqlite.batchInsert(DbImage) {
|
||||||
h2.from(DbImage).select().forEach { data ->
|
for (data in list) {
|
||||||
item {
|
item {
|
||||||
set(DbImage.id, data[DbImage.id])
|
set(DbImage.id, data[DbImage.id])
|
||||||
set(DbImage.accessed, data[DbImage.accessed])
|
set(DbImage.accessed, data[DbImage.accessed])
|
||||||
|
@ -68,6 +69,7 @@ fun migrate(path: Path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Files.move(h2file, path.resolve("metadata.mv.db.old"))
|
Files.move(h2file, path.resolve("metadata.mv.db.old"))
|
||||||
}
|
}
|
||||||
|
|
6
src/main/kotlin/mdnet/cache/ImageStorage.kt
vendored
6
src/main/kotlin/mdnet/cache/ImageStorage.kt
vendored
|
@ -286,12 +286,10 @@ class ImageStorage(
|
||||||
|
|
||||||
private inner class WriterImpl(private val id: String, metadata: ImageMetadata) : Writer {
|
private inner class WriterImpl(private val id: String, metadata: ImageMetadata) : Writer {
|
||||||
val tempPath = getTempPath()
|
val tempPath = getTempPath()
|
||||||
override val stream: OutputStream
|
override val stream: OutputStream = Files.newOutputStream(tempPath, StandardOpenOption.CREATE_NEW)
|
||||||
val metadataSize: Int
|
val metadataSize: Int
|
||||||
|
|
||||||
init {
|
init {
|
||||||
stream = Files.newOutputStream(tempPath, StandardOpenOption.CREATE_NEW)
|
|
||||||
|
|
||||||
val dataOutputStream = DataOutputStream(stream)
|
val dataOutputStream = DataOutputStream(stream)
|
||||||
dataOutputStream.writeUTF(
|
dataOutputStream.writeUTF(
|
||||||
JACKSON.writeValueAsString(metadata)
|
JACKSON.writeValueAsString(metadata)
|
||||||
|
@ -338,7 +336,7 @@ class ImageStorage(
|
||||||
getPath(id),
|
getPath(id),
|
||||||
StandardCopyOption.ATOMIC_MOVE
|
StandardCopyOption.ATOMIC_MOVE
|
||||||
)
|
)
|
||||||
} catch (e: FileAlreadyExistsException) {
|
} catch (e: IOException) {
|
||||||
// the file already exists
|
// the file already exists
|
||||||
// so we must lost the race
|
// so we must lost the race
|
||||||
// delete our local copy
|
// delete our local copy
|
||||||
|
|
|
@ -117,7 +117,7 @@ sealed class NettyTransport(threads: Int) {
|
||||||
return IOUringTransport(threadsToUse)
|
return IOUringTransport(threadsToUse)
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info(IOUring.unavailabilityCause()) {
|
LOGGER.info(IOUring.unavailabilityCause()) {
|
||||||
"IOUring transport not available"
|
"IOUring transport not available (this may be normal)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ sealed class NettyTransport(threads: Int) {
|
||||||
return EpollTransport(threadsToUse)
|
return EpollTransport(threadsToUse)
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info(Epoll.unavailabilityCause()) {
|
LOGGER.info(Epoll.unavailabilityCause()) {
|
||||||
"Epoll transport not available"
|
"Epoll transport not available (this may be normal)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,8 @@ fun catchAllHideDetails(): Filter {
|
||||||
try {
|
try {
|
||||||
next(request)
|
next(request)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
LOGGER.warn(e) { "Request error detected" }
|
val cleanedUri = request.uri.path.replaceBefore("/data", "/{token}")
|
||||||
|
LOGGER.warn(e) { "Request for $cleanedUri errored" }
|
||||||
|
|
||||||
Response(Status.INTERNAL_SERVER_ERROR)
|
Response(Status.INTERNAL_SERVER_ERROR)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue