Skip to content

Commit 60edfcf

Browse files
committed
chore: repo change was missing :(
Signed-off-by: Sven Kanoldt <sven@d34dl0ck.me>
1 parent 18411f3 commit 60edfcf

5 files changed

Lines changed: 29 additions & 8 deletions

File tree

.github/workflows/pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
<li><a href="2026-Q2/">2026 / Q2 — Crux + gpui</a></li>
8888
</ul>
8989
<footer>
90-
<a href="https://github.com/sassman/rust-munich-hacking">source on GitHub</a>
90+
<a href="https://github.com/rust-munich/hacking-evening">source on GitHub</a>
9191
</footer>
9292
</main>
9393
</body>

2026-Q2/workshop/book.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "Workshop slide deck: build a native desktop app with Crux (logic)
88
[output.html]
99
default-theme = "ayu"
1010
preferred-dark-theme = "ayu"
11-
git-repository-url = "https://github.com/sassman/rust-meetup-2026-q2-ideation"
11+
git-repository-url = "https://github.com/rust-munich/hacking-evening"
1212

1313
# Rendered as plain mdbook for reading, and via `mdslides` for the projector.
1414
# mdslides splits a new slide on every `#` or `##` heading.

2026-Q2/workshop/index-template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ <h1 class="title">Crux + gpui</h1>
132132

133133
<footer>
134134
Press <code>?</code> on a slide for keyboard shortcuts ·
135-
<a href="https://github.com/sassman/rust-meetup-2026-q2-ideation">source on GitHub</a>
135+
<a href="https://github.com/rust-munich/hacking-evening">source on GitHub</a>
136136
</footer>
137137
</main>
138138
</body>

2026-Q2/workshop/src/20-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ before we explain any code.
1818
## 1. Clone the workshop repo
1919

2020
```bash
21-
git clone https://github.com/sassman/rust-meetup-2026-q2-ideation.git
21+
git clone https://github.com/rust-munich/hacking-evening.git
2222
cd rust-meetup-2026-q2-ideation
2323
```
2424

2026-Q2/workshop/src/32-step3-add-weather.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ Three small additions to the data we already have:
1616
pub struct WeatherSnapshot {
1717
pub temp_c: f32,
1818
pub condition: WeatherCondition,
19-
pub fetched_at: String,
19+
/// Wall-clock time when the shell received the response. The shell
20+
/// stamps it; the core only compares it for the refresh throttle.
21+
pub fetched_at: std::time::SystemTime,
2022
}
2123

2224
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -78,10 +80,16 @@ done. Strongly typed end-to-end.
7880
A small helper, used by both `Increment` and `Decrement`:
7981

8082
```rust
83+
const WEATHER_REFRESH_AFTER: Duration = Duration::from_secs(10);
84+
8185
fn after_count_change(model: &mut Model) -> Command<Effect, Event> {
8286
use crux_core::render::render;
8387
let render_cmd = render();
84-
if model.count % 10 == 0 && !model.weather_in_flight {
88+
let should_fetch = model.count != 0
89+
&& model.count % 10 == 0
90+
&& !model.weather_in_flight
91+
&& weather_is_stale(model.last_weather.as_ref());
92+
if should_fetch {
8593
model.weather_in_flight = true;
8694
let fetch_cmd = Command::request_from_shell(FetchMunichWeather)
8795
.then_send(Event::WeatherLoaded);
@@ -90,14 +98,27 @@ fn after_count_change(model: &mut Model) -> Command<Effect, Event> {
9098
render_cmd
9199
}
92100
}
101+
102+
fn weather_is_stale(last: Option<&WeatherSnapshot>) -> bool {
103+
match last {
104+
None => true,
105+
Some(snap) => SystemTime::now()
106+
.duration_since(snap.fetched_at)
107+
.map(|elapsed| elapsed >= WEATHER_REFRESH_AFTER)
108+
.unwrap_or(true),
109+
}
110+
}
93111
```
94112

95113
- `request_from_shell(...)` — ask the shell to perform an effect.
96114
- `.then_send(Event::WeatherLoaded)` — when the result comes back, wrap it
97115
in this event and feed it through `update` again.
98116
- `Command::all(...)` — emit several commands at once.
99-
- `weather_in_flight` is the guard that stops rapid clicks from firing
100-
several requests concurrently.
117+
- `weather_in_flight` is the in-flight guard that stops rapid clicks from
118+
firing several requests concurrently.
119+
- `weather_is_stale(...)` is the time-based throttle. With both guards in
120+
place we never hammer the API: at most one request in flight, and never
121+
more than once every 10 seconds.
101122

102123
## The new `update`
103124

0 commit comments

Comments
 (0)