Skip to content

Commit

Permalink
Refresh neurons after spawning or disbursing (#5160)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Jan 11, 2024
1 parent 6691d1b commit 9ce72c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/canisters/neuron_controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- Separate spawning neurons from active neurons ([#5159](https://github.com/open-chat-labs/open-chat/pull/5159))
- Refresh neurons after spawning or disbursing ([#5160](https://github.com/open-chat-labs/open-chat/pull/5160))

## [[2.0.1002](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1002-neuron_controller)] - 2024-01-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,20 @@ async fn run_async() {
}
});

let mut neurons_updated = false;
if !neurons_to_spawn.is_empty() {
spawn_neurons(neurons_to_spawn).await;
neurons_updated = true;
}

if !neurons_to_disburse.is_empty() {
disburse_neurons(neurons_to_disburse).await;
neurons_updated = true;
}

if neurons_updated {
// Refresh the neurons again given that they've been updated
ic_cdk_timers::set_timer(Duration::ZERO, || ic_cdk::spawn(run_async()));
}
}
}
Expand Down

0 comments on commit 9ce72c9

Please sign in to comment.