File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " mithril-aggregator"
3
- version = " 0.4.9 "
3
+ version = " 0.4.10 "
4
4
description = " A Mithril Aggregator server"
5
5
authors = { workspace = true }
6
6
edition = { workspace = true }
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ impl ServeCommand {
164
164
}
165
165
166
166
join_set. spawn ( async { tokio:: signal:: ctrl_c ( ) . await . map_err ( |e| e. to_string ( ) ) } ) ;
167
- dependencies_builder. vanish ( ) ;
167
+ dependencies_builder. vanish ( ) . await ;
168
168
169
169
if let Err ( e) = join_set. join_next ( ) . await . unwrap ( ) ? {
170
170
crit ! ( "A critical error occurred: {e}" ) ;
Original file line number Diff line number Diff line change @@ -258,6 +258,13 @@ impl DependenciesBuilder {
258
258
}
259
259
260
260
// configure session
261
+ connection
262
+ . execute ( "pragma journal_mode = wal; pragma synchronous = normal;" )
263
+ . map_err ( |e| DependenciesBuilderError :: Initialization {
264
+ message : "SQLite initialization: could not enable WAL." . to_string ( ) ,
265
+ error : Some ( e. into ( ) ) ,
266
+ } ) ?;
267
+
261
268
connection
262
269
. execute ( "pragma foreign_keys=true" )
263
270
. map_err ( |e| DependenciesBuilderError :: Initialization {
@@ -273,6 +280,12 @@ impl DependenciesBuilder {
273
280
Ok ( connection)
274
281
}
275
282
283
+ async fn drop_sqlite_connection ( & self ) {
284
+ if let Some ( connection) = & self . sqlite_connection {
285
+ let _ = connection. execute ( "pragma analysis_limit=400; pragma optimize;" ) ;
286
+ }
287
+ }
288
+
276
289
/// Get SQLite connection
277
290
pub async fn get_sqlite_connection ( & mut self ) -> Result < Arc < ConnectionWithFullMutex > > {
278
291
if self . sqlite_connection . is_none ( ) {
@@ -1196,5 +1209,7 @@ impl DependenciesBuilder {
1196
1209
}
1197
1210
1198
1211
/// Remove the dependencies builder from memory to release Arc.
1199
- pub fn vanish ( self ) { }
1212
+ pub async fn vanish ( self ) {
1213
+ self . drop_sqlite_connection ( ) . await ;
1214
+ }
1200
1215
}
You can’t perform that action at this time.
0 commit comments