-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stats storages and crash in Aggregate mode #421
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,14 @@ class TagLabeledNStorage( | |
override suspend fun init() { | ||
val storage = locateStorage() | ||
if (storage?.exists() == true) { | ||
val json = Json.decodeFromStream<JsonTagLabeledN>(storage.inputStream()) | ||
tagLabeledAmount.putAll(json.data) | ||
try { | ||
val json = Json.decodeFromStream<JsonTagLabeledN>( | ||
storage.inputStream() | ||
) | ||
tagLabeledAmount.putAll(json.data) | ||
} catch (exception: Exception) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that just logging the exception can be harmful for the storage. We can have 2 kinds of exception here:
In either case, the Stats storage is not that important comparing to tags or scores, but it enhances UX by sorting tags in last-used order. We should avoid losing this data if possible. |
||
Timber.e("TagLabeledNStorage.init exception: " + exception.message) | ||
} | ||
} else { | ||
index.allIds() | ||
.associateWith { tagsStorage.getTags(it) } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for fixing a side effect when files access permission toggle was disabled, caused by this commit: c7d14c1