Skip to content

Commit

Permalink
listen: Use with_stack_buffer() where I think it will help.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Nov 14, 2024
1 parent 4aa4065 commit 5513cfe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions all-is-cubes-ui/src/apps/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ impl SpaceWatchState {
// TODO: do not discard spatial information; and add source information
Some(sf.fluff.clone())
})
.with_stack_buffer::<10>() // TODO: non-arbitrary number
.gate();
space_read.fluff().listen(fluff_forwarder);
Ok(Self {
Expand Down
17 changes: 10 additions & 7 deletions all-is-cubes-ui/src/inv_watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ impl InventoryWatcher {
Ok(cg) => {
character_guard = cg;
if let Some(l) = listener_to_install {
character_guard.listen(l.filter(|cc| match cc {
// This match is useless now, but in the future there will probably
// be CharacterChange messages we want to ignore.
CharacterChange::Inventory(_) | CharacterChange::Selections => {
Some(WatcherChange::NeedsUpdate)
}
}));
character_guard.listen(
l.filter(|cc| match cc {
// This match is useless now, but in the future there will probably
// be CharacterChange messages we want to ignore.
CharacterChange::Inventory(_) | CharacterChange::Selections => {
Some(WatcherChange::NeedsUpdate)
}
})
.with_stack_buffer::<100>(),
);
}
(
character_guard.inventory(),
Expand Down
5 changes: 4 additions & 1 deletion all-is-cubes/src/raytracer/updating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ where

// TODO: Placeholder for more detailed graphics options updating
graphics_options.listen(
TodoListener(Arc::downgrade(&todo)).filter(|&()| Some(SpaceChange::EveryBlock)),
// TODO: this filter should be coalescing instead of having a large buffer
TodoListener(Arc::downgrade(&todo))
.filter(|&()| Some(SpaceChange::EveryBlock))
.with_stack_buffer::<1000>(),
);

Self {
Expand Down

0 comments on commit 5513cfe

Please sign in to comment.