Update connection verification-related logic
This commit is contained in:
		
							parent
							
								
									6a6210ecb7
								
							
						
					
					
						commit
						b34a6f8935
					
				
					 2 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -266,16 +266,16 @@ class ConnectionController:
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def await_connection(port_number: int, connection_observer: Optional[ConnectionObserver] = None):
 | 
					    def await_connection(port_number: int, connection_observer: Optional[ConnectionObserver] = None):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        maximum_amount_of_retries = 10
 | 
					        maximum_number_of_attempts = 5
 | 
				
			||||||
        retry_interval = 5.0
 | 
					        retry_interval = 5.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for retry_count in range(maximum_amount_of_retries):
 | 
					        for retry_count in range(maximum_number_of_attempts):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if connection_observer is not None:
 | 
					            if connection_observer is not None:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                connection_observer.notify('connecting', dict(
 | 
					                connection_observer.notify('connecting', dict(
 | 
				
			||||||
                    retry_interval=retry_interval,
 | 
					                    retry_interval=retry_interval,
 | 
				
			||||||
                    maximum_amount_of_retries=maximum_amount_of_retries,
 | 
					                    maximum_number_of_attempts=maximum_number_of_attempts,
 | 
				
			||||||
                    attempt_count=retry_count + 1
 | 
					                    attempt_count=retry_count + 1
 | 
				
			||||||
                ))
 | 
					                ))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.py
									
									
									
									
									
								
							| 
						 | 
					@ -38,7 +38,7 @@ if __name__ == '__main__':
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    application_version_observer.subscribe('downloading', lambda event: print(f'Downloading {ApplicationController.get(event.subject.application_code).name}, version {event.subject.version_number}...\n'))
 | 
					    application_version_observer.subscribe('downloading', lambda event: print(f'Downloading {ApplicationController.get(event.subject.application_code).name}, version {event.subject.version_number}...\n'))
 | 
				
			||||||
    client_observer.subscribe('synchronizing', lambda event: print('Synchronizing...\n'))
 | 
					    client_observer.subscribe('synchronizing', lambda event: print('Synchronizing...\n'))
 | 
				
			||||||
    connection_observer.subscribe('connecting', lambda event: print(f'[{event.subject.get("attempt_count")}/{event.subject.get("maximum_amount_of_retries")}] Performing connection attempt...\n'))
 | 
					    connection_observer.subscribe('connecting', lambda event: print(f'[{event.subject.get("attempt_count")}/{event.subject.get("maximum_number_of_attempts")}] Performing connection attempt...\n'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    invoice_observer.subscribe('retrieved', lambda event: print(f'\n{pprint.pp(event.subject)}\n'))
 | 
					    invoice_observer.subscribe('retrieved', lambda event: print(f'\n{pprint.pp(event.subject)}\n'))
 | 
				
			||||||
    invoice_observer.subscribe('processing', lambda event: print('A payment has been detected and is being verified...\n'))
 | 
					    invoice_observer.subscribe('processing', lambda event: print('A payment has been detected and is being verified...\n'))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue