mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-09-11 19:17:43 +03:00
chore: drop old user awarenss when open workspace (#5271)
This commit is contained in:
parent
560529f7d9
commit
3bdc8c222c
@ -7,7 +7,7 @@ use collab_entity::reminder::Reminder;
|
||||
use collab_entity::CollabType;
|
||||
use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig};
|
||||
use collab_user::core::{MutexUserAwareness, UserAwareness};
|
||||
use tracing::{error, info, instrument, trace};
|
||||
use tracing::{debug, error, info, instrument, trace};
|
||||
|
||||
use collab_integrate::CollabKVDB;
|
||||
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
|
||||
@ -127,6 +127,12 @@ impl UserManager {
|
||||
}
|
||||
self.is_loading_awareness.store(true, Ordering::SeqCst);
|
||||
|
||||
if let Some(old_user_awareness) = self.user_awareness.lock().await.take() {
|
||||
debug!("Closing old user awareness");
|
||||
old_user_awareness.lock().close();
|
||||
drop(old_user_awareness);
|
||||
}
|
||||
|
||||
let object_id =
|
||||
user_awareness_object_id(&session.user_uuid, &session.user_workspace.id).to_string();
|
||||
trace!("Initializing user awareness {}", object_id);
|
||||
|
@ -166,6 +166,13 @@ impl UserManager {
|
||||
.authenticate_user
|
||||
.set_user_workspace(user_workspace.clone())?;
|
||||
|
||||
if let Err(err) = self.try_initial_user_awareness(&self.get_session()?).await {
|
||||
error!(
|
||||
"Failed to initialize user awareness when opening workspace: {:?}",
|
||||
err
|
||||
);
|
||||
}
|
||||
|
||||
let uid = self.user_id()?;
|
||||
if let Err(err) = self
|
||||
.user_status_callback
|
||||
|
Loading…
Reference in New Issue
Block a user