Restructure server around Server struct
This commit is contained in:
parent
45abda2b6d
commit
9bdfc79c8b
5 changed files with 92 additions and 95 deletions
|
|
@ -8,9 +8,9 @@ mod repo;
|
|||
|
||||
use tracing::{debug_span, error, Instrument};
|
||||
|
||||
use crate::state::AppState;
|
||||
use super::Server;
|
||||
|
||||
async fn recurring_task(state: &AppState) {
|
||||
async fn recurring_task(state: &Server) {
|
||||
async {
|
||||
if let Err(e) = repo::update(&state.db, state.repo.clone()).await {
|
||||
error!("Error updating repo:\n{e:?}");
|
||||
|
|
@ -28,7 +28,7 @@ async fn recurring_task(state: &AppState) {
|
|||
.await;
|
||||
}
|
||||
|
||||
pub async fn run(state: AppState) {
|
||||
pub async fn run(state: Server) {
|
||||
loop {
|
||||
recurring_task(&state).await;
|
||||
tokio::time::sleep(state.config.repo.update_delay).await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue