fix(channels): use platform message IDs to prevent duplicate memories
Fixes #430 - Prevents duplicate memories after restart by using platform message IDs instead of random UUIDs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use parking_lot::Mutex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::Instant;
|
||||
|
||||
@@ -40,9 +40,7 @@ impl ActionTracker {
|
||||
|
||||
/// Record an action and return the current count within the window.
|
||||
pub fn record(&self) -> usize {
|
||||
let mut actions = self
|
||||
.actions
|
||||
.lock();
|
||||
let mut actions = self.actions.lock();
|
||||
let cutoff = Instant::now()
|
||||
.checked_sub(std::time::Duration::from_secs(3600))
|
||||
.unwrap_or_else(Instant::now);
|
||||
@@ -53,9 +51,7 @@ impl ActionTracker {
|
||||
|
||||
/// Count of actions in the current window without recording.
|
||||
pub fn count(&self) -> usize {
|
||||
let mut actions = self
|
||||
.actions
|
||||
.lock();
|
||||
let mut actions = self.actions.lock();
|
||||
let cutoff = Instant::now()
|
||||
.checked_sub(std::time::Duration::from_secs(3600))
|
||||
.unwrap_or_else(Instant::now);
|
||||
@@ -66,9 +62,7 @@ impl ActionTracker {
|
||||
|
||||
impl Clone for ActionTracker {
|
||||
fn clone(&self) -> Self {
|
||||
let actions = self
|
||||
.actions
|
||||
.lock();
|
||||
let actions = self.actions.lock();
|
||||
Self {
|
||||
actions: Mutex::new(actions.clone()),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user