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