| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -153,7 +153,7 @@ class WebPushService(): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return True | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        except WebPushException as ex: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            print(f"Failed to send push notification: {ex}") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            print(f"Failed to send push notification for {subscription_info['endpoint']} -- {ex}") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return False | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -176,6 +176,9 @@ class WebPushService(): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        while True: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            now = datetime.datetime.now().isoformat() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            print(f"{now} - Starting to send subscriptions...") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            # Creating a context for the application to enable database operations | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            with self.app.app_context(): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -186,7 +189,6 @@ class WebPushService(): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                vapid_key = VAPIDKey.query.first() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                # Constructing the push notification message | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                now = datetime.datetime.now().isoformat() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                message = {"title": "Daily Update", "message": f"Update for {now}"} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                # Sending a push notification to each subscribed client | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -199,6 +201,7 @@ class WebPushService(): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    WebPushService._send_push_notification(subscription_info, message, vapid_key) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                print(f"{now} - Finished sending {len(all_subscriptions)} subscriptions.") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            # Sleeping for 24 hours before sending the next set of notifications | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            time.sleep(24 * 60 * 60) | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |