Skip to content

Commit 204163f

Browse files
authored
bug: Store message state in Redis to solve for some reliability state management issues (#1005)
Move the individual message state to Redis. This is to attempt to stop some reliability counts from trending negative. This is after the code paths were scrutinized to ensure that the struct cloning was minimized, and some states (notably, ones where there was a hand-off between active services) continued to trend negative. Unfortunately, the currently available version of Redis is 7.2, so many of the auto-expiring records (like [HSETEX](https://redis.io/docs/latest/commands/hsetex/) are not present, meaning that we'll have to use more keys, and use traditional `SET` with an `EX`piration set. Fortunately, that should not be a problem, since there appears to be plenty of available memory and CPU on the active Redis servers. The new approach _only_ updates counts if the prior state matches what has been last recorded. Closes: PUSH-546
1 parent 43c3ad7 commit 204163f

File tree

3 files changed

+413
-52
lines changed

3 files changed

+413
-52
lines changed

autoendpoint/src/extractors/notification.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ impl Notification {
234234
&self.reliable_state,
235235
Some(self.timestamp + self.headers.ttl as u64),
236236
)
237-
.await;
237+
.await
238+
.inspect_err(|e| {
239+
warn!("🔍⚠️ Unable to record reliability state log: {:?}", e);
240+
})
241+
.unwrap_or(Some(state))
238242
}
239243
}

autopush-common/src/notification.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ impl Notification {
9090
&self.reliable_state,
9191
Some(self.expiry()),
9292
)
93-
.await;
93+
.await
94+
.inspect_err(|e| {
95+
warn!("🔍⚠️ Unable to record reliability state log: {:?}", e);
96+
})
97+
.unwrap_or_default();
9498
}
9599

96100
#[cfg(feature = "reliable_report")]

0 commit comments

Comments
 (0)