1
0
Fork 1
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:
carbotaniuman 2021-02-23 11:18:47 -06:00
parent 3812fcab47
commit a33a1dcc44
4 changed files with 14 additions and 13 deletions

View file

@ -59,12 +59,14 @@ fun migrate(path: Path) {
}
}
sqlite.batchInsert(DbImage) {
h2.from(DbImage).select().forEach { data ->
item {
set(DbImage.id, data[DbImage.id])
set(DbImage.accessed, data[DbImage.accessed])
set(DbImage.size, data[DbImage.size])
h2.from(DbImage).select().asIterable().chunked(1000).forEach { list ->
sqlite.batchInsert(DbImage) {
for (data in list) {
item {
set(DbImage.id, data[DbImage.id])
set(DbImage.accessed, data[DbImage.accessed])
set(DbImage.size, data[DbImage.size])
}
}
}
}

View file

@ -286,12 +286,10 @@ class ImageStorage(
private inner class WriterImpl(private val id: String, metadata: ImageMetadata) : Writer {
val tempPath = getTempPath()
override val stream: OutputStream
override val stream: OutputStream = Files.newOutputStream(tempPath, StandardOpenOption.CREATE_NEW)
val metadataSize: Int
init {
stream = Files.newOutputStream(tempPath, StandardOpenOption.CREATE_NEW)
val dataOutputStream = DataOutputStream(stream)
dataOutputStream.writeUTF(
JACKSON.writeValueAsString(metadata)
@ -338,7 +336,7 @@ class ImageStorage(
getPath(id),
StandardCopyOption.ATOMIC_MOVE
)
} catch (e: FileAlreadyExistsException) {
} catch (e: IOException) {
// the file already exists
// so we must lost the race
// delete our local copy

View file

@ -117,7 +117,7 @@ sealed class NettyTransport(threads: Int) {
return IOUringTransport(threadsToUse)
} else {
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)
} else {
LOGGER.info(Epoll.unavailabilityCause()) {
"Epoll transport not available"
"Epoll transport not available (this may be normal)"
}
}
}

View file

@ -51,7 +51,8 @@ fun catchAllHideDetails(): Filter {
try {
next(request)
} 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)
}