remove not save peer config when version is zero
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
		
							parent
							
								
									c749ebff46
								
							
						
					
					
						commit
						87600d36e4
					
				| @ -1151,10 +1151,6 @@ impl LoginConfigHandler { | |||||||
|     ///
 |     ///
 | ||||||
|     /// * `config` - [`PeerConfig`] to save.
 |     /// * `config` - [`PeerConfig`] to save.
 | ||||||
|     pub fn save_config(&mut self, config: PeerConfig) { |     pub fn save_config(&mut self, config: PeerConfig) { | ||||||
|         if self.version == 0 { |  | ||||||
|             log::info!("skip saving peer config {}", self.id); |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|         config.store(&self.id); |         config.store(&self.id); | ||||||
|         self.config = config; |         self.config = config; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -850,11 +850,6 @@ impl<T: InvokeUiSession> Remote<T> { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pub async fn sync_jobs_status_to_local(&mut self) -> bool { |     pub async fn sync_jobs_status_to_local(&mut self) -> bool { | ||||||
|         let peer_version = self.handler.lc.read().unwrap().version; |  | ||||||
|         if peer_version == 0 { |  | ||||||
|             log::info!("skip saving job status"); |  | ||||||
|             return false; |  | ||||||
|         } |  | ||||||
|         log::info!("sync transfer job status"); |         log::info!("sync transfer job status"); | ||||||
|         let mut config: PeerConfig = self.handler.load_config(); |         let mut config: PeerConfig = self.handler.load_config(); | ||||||
|         let mut transfer_metas = TransferSerde::default(); |         let mut transfer_metas = TransferSerde::default(); | ||||||
| @ -867,8 +862,10 @@ impl<T: InvokeUiSession> Remote<T> { | |||||||
|             transfer_metas.write_jobs.push(json_str); |             transfer_metas.write_jobs.push(json_str); | ||||||
|         } |         } | ||||||
|         log::info!("meta: {:?}", transfer_metas); |         log::info!("meta: {:?}", transfer_metas); | ||||||
|  |         if config.transfer != transfer_metas { | ||||||
|             config.transfer = transfer_metas; |             config.transfer = transfer_metas; | ||||||
|             self.handler.save_config(config); |             self.handler.save_config(config); | ||||||
|  |         } | ||||||
|         true |         true | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user