mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-08 17:35:18 +00:00
add yomitan.db cleanup (which doesn't help)
This commit is contained in:
1 parent
bd281a3b2e
commit
641f23538b
4 files changed
+19
-3
No files matched your search
@@ -73,6 +73,11 @@ impl YomitanWriter {
|
||||
Ok(Self { conn })
|
||||
}
|
||||
|
||||
pub fn cleanup(&self) -> Result<()> {
|
||||
self.conn.execute_batch("VACUUM")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn create_schema(&mut self) -> Result<()> {
|
||||
self.conn.execute_batch(
|
||||
"
|
||||
|
||||
@@ -51,6 +51,13 @@ impl AppService {
|
||||
Ok(writer)
|
||||
}
|
||||
|
||||
pub fn cleanup_yomitan_writer(&self) -> Result<YomitanWriter, CJDicError> {
|
||||
let conn = Connection::open(self.db.dir.join(YOMITAN_DBFILE))?;
|
||||
let writer = YomitanWriter::new(conn)?;
|
||||
writer.cleanup()?;
|
||||
Ok(writer)
|
||||
}
|
||||
|
||||
pub fn load_yomitan_zip_dir<Z, LoadCallback, ImportCallback>(
|
||||
&self,
|
||||
zip_dir: Vec<Z>,
|
||||
@@ -145,7 +152,7 @@ impl AppService {
|
||||
}
|
||||
|
||||
pub fn import_yomitan_zip_file<Z, Callback>(
|
||||
writer: &mut YomitanWriter,
|
||||
writer: &mut YomitanWriter, // Reuse existing connection
|
||||
zip_file: &Z,
|
||||
lang: &str,
|
||||
progress_callback: Callback,
|
||||
|
||||
@@ -40,7 +40,7 @@ function LoadingDialog() {
|
||||
if (payload.new_dicts.length > 0) {
|
||||
messages = [
|
||||
...messages,
|
||||
{ message: "Importing Yomitan zip in resources/ folder:" },
|
||||
{ message: "Importing Yomitan zip from the app bundle:" },
|
||||
...payload.new_dicts.map((d) => ({ message: `- ${d}` })),
|
||||
];
|
||||
}
|
||||
@@ -48,7 +48,7 @@ function LoadingDialog() {
|
||||
if (payload.to_be_removed_dicts.length > 0) {
|
||||
messages = [
|
||||
...messages,
|
||||
{ message: "Removing Yomitan zip:" },
|
||||
{ message: "Removing old Yomitan zip:" },
|
||||
...payload.to_be_removed_dicts.map((d) => ({ message: `- ${d}` })),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -71,6 +71,10 @@ pub async fn init_yomitan(
|
||||
)?;
|
||||
|
||||
if r.new_dicts.len() + r.to_be_removed_dicts.len() > 0 {
|
||||
// Cleanup doesn't appear to help even after app restart
|
||||
// state.cleanup_yomitan_writer()?;
|
||||
|
||||
// Request app restart anyway
|
||||
app.request_restart();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user