1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00

Add sanity guard

This commit is contained in:
carbotaniuman 2020-06-28 12:36:30 -05:00
parent edf416cfa6
commit 0e6af9e7d3

View file

@ -101,6 +101,7 @@ class MangaDexClient(private val clientSettings: ClientSettings) {
executorService.scheduleAtFixedRate({ executorService.scheduleAtFixedRate({
try { try {
if (state is Running || state is GracefulShutdown || state is Uninitialized) {
statistics.updateAndGet { statistics.updateAndGet {
it.copy(bytesOnDisk = cache.size()) it.copy(bytesOnDisk = cache.size())
} }
@ -110,6 +111,7 @@ class MangaDexClient(private val clientSettings: ClientSettings) {
JACKSON.writeValue(editor.newOutputStream(0), statistics.get()) JACKSON.writeValue(editor.newOutputStream(0), statistics.get())
editor.commit() editor.commit()
} }
}
} catch (e: Exception) { } catch (e: Exception) {
LOGGER.warn("Statistics update failed", e) LOGGER.warn("Statistics update failed", e)
} }