-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:MyJetTools/my-no-sql-server
- Loading branch information
Showing
6 changed files
with
80 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
use std::time::Duration; | ||
use std::{sync::Arc, time::Duration}; | ||
|
||
use crate::app::AppContext; | ||
|
||
pub async fn execute(app: &AppContext) { | ||
pub async fn shutdown(app: &Arc<AppContext>) { | ||
println!("Doing persistence before shut down"); | ||
let duration = Duration::from_secs(1); | ||
while !app.states.is_shutting_down() { | ||
tokio::time::sleep(duration).await; | ||
|
||
while app.persist_markers.has_something_to_persist().await { | ||
println!("Has something to persist. Persisting and checking again..."); | ||
crate::operations::persist::persist(app).await; | ||
tokio::time::sleep(duration).await; | ||
} | ||
|
||
print!("Stopping the application"); | ||
println!("Everthing is persisted. App can be closed now"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters