Merge pull request 'fix: app node cron' (#2) from fix_app-cron into staging
Reviewed-on: #2
This commit is contained in:
commit
eb9a89d1c5
13
src/data.rs
13
src/data.rs
@ -1452,7 +1452,7 @@ impl BrainData {
|
||||
let mut nodes = self.app_nodes.write().unwrap();
|
||||
let mut app_contracts = self.app_contracts.write().unwrap();
|
||||
for node in nodes.iter_mut() {
|
||||
if self.daemon_tx.contains_key(&node.node_pubkey) {
|
||||
if self.app_daemon_tx.contains_key(&node.node_pubkey) {
|
||||
node.offline_minutes = 0;
|
||||
continue;
|
||||
}
|
||||
@ -1501,8 +1501,17 @@ impl BrainData {
|
||||
log::debug!("Running app contracts cron...");
|
||||
{
|
||||
let mut app_contracts = self.app_contracts.write().unwrap();
|
||||
let app_nodes = self.app_nodes.read().unwrap();
|
||||
app_contracts.retain_mut(|c| {
|
||||
let node = self.find_app_node_by_pubkey(&c.node_pubkey).unwrap();
|
||||
let node = match app_nodes
|
||||
.iter()
|
||||
.find(|n| n.node_pubkey == c.node_pubkey)
|
||||
.cloned()
|
||||
{
|
||||
Some(n) => n,
|
||||
None => return c.locked_nano > 0,
|
||||
};
|
||||
|
||||
if node.offline_minutes == 0 {
|
||||
let operator_wallet = node.operator_wallet.clone();
|
||||
let minutes_to_collect = (Utc::now() - c.collected_at).num_minutes() as u64;
|
||||
|
Loading…
Reference in New Issue
Block a user