mirror of
				https://github.com/Blah-IM/blahrs.git
				synced 2025-10-31 10:41:37 +00:00 
			
		
		
		
	fix(event): consistently use i64 for uid
This commit is contained in:
		
							parent
							
								
									a7f31e5fad
								
							
						
					
					
						commit
						4bca196df3
					
				
					 2 changed files with 4 additions and 6 deletions
				
			
		|  | @ -63,7 +63,7 @@ fn de_duration_sec<'de, D: de::Deserializer<'de>>(de: D) -> Result<Duration, D:: | |||
| 
 | ||||
| #[derive(Debug, Default)] | ||||
| pub struct State { | ||||
|     pub user_listeners: Mutex<HashMap<u64, UserEventSender>>, | ||||
|     pub user_listeners: Mutex<HashMap<i64, UserEventSender>>, | ||||
| } | ||||
| 
 | ||||
| #[derive(Debug)] | ||||
|  | @ -103,7 +103,7 @@ type UserEventSender = broadcast::Sender<Arc<SignedChatMsg>>; | |||
| struct UserEventReceiver { | ||||
|     rx: BroadcastStream<Arc<SignedChatMsg>>, | ||||
|     st: Arc<AppState>, | ||||
|     uid: u64, | ||||
|     uid: i64, | ||||
| } | ||||
| 
 | ||||
| impl Drop for UserEventReceiver { | ||||
|  | @ -147,8 +147,7 @@ pub async fn handle_ws(st: Arc<AppState>, ws: &mut WebSocket) -> Result<Infallib | |||
|             .db | ||||
|             .with_read(|txn| txn.get_user(&auth.signee.user)) | ||||
|             .map_err(|err| anyhow!("{}", err.message))?; | ||||
|         // FIXME: Consistency of id's sign.
 | ||||
|         uid as u64 | ||||
|         uid | ||||
|     }; | ||||
| 
 | ||||
|     tracing::debug!(%uid, "user connected"); | ||||
|  |  | |||
|  | @ -583,8 +583,7 @@ async fn room_msg_post( | |||
|     let listeners = st.event.user_listeners.lock(); | ||||
|     let mut cnt = 0usize; | ||||
|     for uid in members { | ||||
|         // FIXME: u64 vs i64.
 | ||||
|         if let Some(tx) = listeners.get(&(uid as u64)) { | ||||
|         if let Some(tx) = listeners.get(&uid) { | ||||
|             if tx.send(chat.clone()).is_ok() { | ||||
|                 cnt += 1; | ||||
|             } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 oxalica
						oxalica