chore: logs (#302)

* chore: logs

* chore: logs
This commit is contained in:
Nathan.fooo 2024-02-07 13:00:29 +08:00 committed by GitHub
parent 6f2faff21f
commit fa13422a05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 10 deletions

View File

@ -47,7 +47,7 @@ where
for (object_id, group) in groups.iter() { for (object_id, group) in groups.iter() {
if group.is_inactive().await { if group.is_inactive().await {
inactive_group_ids.push(object_id.clone()); inactive_group_ids.push(object_id.clone());
if inactive_group_ids.len() > 10 { if inactive_group_ids.len() > 5 {
break; break;
} }
} }
@ -138,7 +138,7 @@ where
} }
} }
#[tracing::instrument(skip(self))] #[tracing::instrument(level = "trace", skip(self))]
async fn init_group( async fn init_group(
&self, &self,
uid: i64, uid: i64,
@ -146,11 +146,7 @@ where
object_id: &str, object_id: &str,
collab_type: CollabType, collab_type: CollabType,
) -> Arc<CollabGroup<U>> { ) -> Arc<CollabGroup<U>> {
event!( event!(tracing::Level::TRACE, "New group:{}", object_id);
tracing::Level::INFO,
"Create new group for object_id:{}",
object_id
);
let collab = MutexCollab::new(CollabOrigin::Server, object_id, vec![]); let collab = MutexCollab::new(CollabOrigin::Server, object_id, vec![]);
let broadcast = CollabBroadcast::new(object_id, collab.clone(), 10); let broadcast = CollabBroadcast::new(object_id, collab.clone(), 10);
let collab = Arc::new(collab.clone()); let collab = Arc::new(collab.clone());
@ -170,7 +166,7 @@ where
self.access_control.clone(), self.access_control.clone(),
); );
collab.lock().add_plugin(Arc::new(plugin)); collab.lock().add_plugin(Arc::new(plugin));
event!(tracing::Level::INFO, "Init group collab:{}", object_id); event!(tracing::Level::TRACE, "Init group collab:{}", object_id);
collab.lock_arc().initialize().await; collab.lock_arc().initialize().await;
self self

View File

@ -465,7 +465,6 @@ async fn create_collab_list_handler(
Ok(Json(AppResponse::Ok())) Ok(Json(AppResponse::Ok()))
} }
#[instrument(level = "trace", skip(payload, state), err)]
async fn get_collab_handler( async fn get_collab_handler(
user_uuid: UserUuid, user_uuid: UserUuid,
payload: Json<QueryCollabParams>, payload: Json<QueryCollabParams>,

View File

@ -111,7 +111,6 @@ where
.context("acquire transaction to upsert collab") .context("acquire transaction to upsert collab")
.map_err(AppError::from)?; .map_err(AppError::from)?;
let (params, workspace_id) = params.split(); let (params, workspace_id) = params.split();
// TODO(nathan): save list of collab within period of time to avoid too many pool connections
self self
.upsert_collab_with_transaction(&workspace_id, uid, params, &mut transaction) .upsert_collab_with_transaction(&workspace_id, uid, params, &mut transaction)
.await?; .await?;