bug fixed
This commit is contained in:
parent
e1cf3ebd54
commit
2584bf8a55
|
@ -64,33 +64,6 @@ impl Scheduler {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn add_history(
|
||||
&'static self,
|
||||
item: String,
|
||||
start_at: i64,
|
||||
code: i64,
|
||||
message: Option<String>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let conn = self.pool.get().expect("conn");
|
||||
let complete_at = (chrono::Utc::now()).timestamp();
|
||||
|
||||
self
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item,
|
||||
start_at,
|
||||
complete_at,
|
||||
code,
|
||||
message,
|
||||
},
|
||||
)
|
||||
.expect("synchronization_history insert");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn balance_for_user(&'static self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let j_synchronization = Job::new_async("0 0 0/1 * * *", move |_uuid, _l| {
|
||||
Box::pin(async move {
|
||||
|
@ -122,28 +95,38 @@ impl Scheduler {
|
|||
}
|
||||
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_BALANCE_USER.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_BALANCE_USER.to_string(),
|
||||
start_at,
|
||||
0,
|
||||
None,
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: 0,
|
||||
message: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
|
||||
Ok::<(), api::core::models::Error>(())
|
||||
}
|
||||
.await
|
||||
{
|
||||
let conn = self.pool.get().expect("conn");
|
||||
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_BALANCE_USER.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_BALANCE_USER.to_string(),
|
||||
start_at,
|
||||
e.code,
|
||||
e.msg.clone(),
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: e.code,
|
||||
message: e.msg,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
}
|
||||
})
|
||||
})?;
|
||||
|
@ -197,28 +180,37 @@ impl Scheduler {
|
|||
}
|
||||
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_BALANCE_USER.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_BALANCE_PARTNER.to_string(),
|
||||
start_at,
|
||||
0,
|
||||
None,
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: 0,
|
||||
message: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
|
||||
Ok::<(), api::core::models::Error>(())
|
||||
}
|
||||
.await
|
||||
{
|
||||
let conn = self.pool.get().expect("conn");
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_BALANCE_USER.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_BALANCE_PARTNER.to_string(),
|
||||
start_at,
|
||||
e.code,
|
||||
e.msg.clone(),
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: e.code,
|
||||
message: e.msg,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
}
|
||||
})
|
||||
})?;
|
||||
|
|
|
@ -63,33 +63,6 @@ impl Scheduler {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn add_history(
|
||||
&'static self,
|
||||
item: String,
|
||||
start_at: i64,
|
||||
code: i64,
|
||||
message: Option<String>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let complete_at = (chrono::Utc::now()).timestamp();
|
||||
let conn = self.pool.get().expect("conn");
|
||||
|
||||
self
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item,
|
||||
start_at,
|
||||
complete_at,
|
||||
code,
|
||||
message,
|
||||
},
|
||||
)
|
||||
.expect("synchronization_history insert");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn list_vendors(&'static self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let j_synchronization = Job::new_async("0 0 0/1 * * *", move |_uuid, _l| {
|
||||
Box::pin(async move {
|
||||
|
@ -124,14 +97,18 @@ impl Scheduler {
|
|||
.expect("vendor upsert");
|
||||
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_VENDORS.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_VENDORS.to_string(),
|
||||
start_at,
|
||||
0,
|
||||
None,
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: 0,
|
||||
message: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
|
||||
self.list_games().await;
|
||||
|
||||
|
@ -139,15 +116,20 @@ impl Scheduler {
|
|||
}
|
||||
.await
|
||||
{
|
||||
let conn = self.pool.get().expect("conn");
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_VENDORS.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_VENDORS.to_string(),
|
||||
start_at,
|
||||
e.code,
|
||||
e.msg.clone(),
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: e.code,
|
||||
message: e.msg,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
}
|
||||
})
|
||||
})?;
|
||||
|
@ -203,28 +185,37 @@ impl Scheduler {
|
|||
.expect("game upsert");
|
||||
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_GAMES.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_GAMES.to_string(),
|
||||
start_at,
|
||||
0,
|
||||
None,
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: 0,
|
||||
message: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
|
||||
Ok::<(), api::core::models::Error>(())
|
||||
}
|
||||
.await
|
||||
{
|
||||
let conn = self.pool.get().expect("conn");
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_GAMES.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_GAMES.to_string(),
|
||||
start_at,
|
||||
e.code,
|
||||
e.msg.clone(),
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: e.code,
|
||||
message: e.msg,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,33 +59,6 @@ impl Scheduler {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn add_history(
|
||||
&'static self,
|
||||
item: String,
|
||||
start_at: i64,
|
||||
code: i64,
|
||||
message: Option<String>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let conn = self.pool.get().expect("conn");
|
||||
let complete_at = (chrono::Utc::now()).timestamp();
|
||||
|
||||
self
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item,
|
||||
start_at,
|
||||
complete_at,
|
||||
code,
|
||||
message,
|
||||
},
|
||||
)
|
||||
.expect("synchronization_history insert");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn list_members(&'static self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let j_synchronization = Job::new_async("0 0 0/1 * * *", move |_uuid, _l| {
|
||||
Box::pin(async move {
|
||||
|
@ -111,28 +84,37 @@ impl Scheduler {
|
|||
}
|
||||
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_MEMBERS.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_MEMBERS.to_string(),
|
||||
start_at,
|
||||
0,
|
||||
None,
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: 0,
|
||||
message: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
|
||||
Ok::<(), api::core::models::Error>(())
|
||||
}
|
||||
.await
|
||||
{
|
||||
let conn = self.pool.get().expect("conn");
|
||||
self
|
||||
.add_history(
|
||||
repositories::synchronization::models::ITEM_MEMBERS.to_string(),
|
||||
.synchronization_history_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::synchronization_history::models::NewSynchronizationHistory {
|
||||
item: repositories::synchronization::models::ITEM_MEMBERS.to_string(),
|
||||
start_at,
|
||||
e.code,
|
||||
e.msg.clone(),
|
||||
complete_at: (chrono::Utc::now()).timestamp(),
|
||||
code: e.code,
|
||||
message: e.msg,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("add_history");
|
||||
.expect("synchronization_history insert");
|
||||
}
|
||||
})
|
||||
})?;
|
||||
|
|
Loading…
Reference in New Issue
Block a user