Fix calculation of EmgauwaNow in relay loop
This commit is contained in:
		
							parent
							
								
									2eb38ec11e
								
							
						
					
					
						commit
						bb982c4444
					
				
					 1 changed files with 8 additions and 5 deletions
				
			
		| 
						 | 
					@ -36,11 +36,6 @@ async fn run_relays(app_state: &Addr<AppState>) -> Result<(), EmgauwaError> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	loop {
 | 
						loop {
 | 
				
			||||||
		let now = EmgauwaNow::now();
 | 
							let now = EmgauwaNow::now();
 | 
				
			||||||
		log::debug!(
 | 
					 | 
				
			||||||
			"Relay loop at {}: {}",
 | 
					 | 
				
			||||||
			now.time,
 | 
					 | 
				
			||||||
			printable_relay_states(&this.get_relay_states())
 | 
					 | 
				
			||||||
		);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		let notifier_future = notifier.notified();
 | 
							let notifier_future = notifier.notified();
 | 
				
			||||||
		pin_mut!(notifier_future);
 | 
							pin_mut!(notifier_future);
 | 
				
			||||||
| 
						 | 
					@ -51,6 +46,8 @@ async fn run_relays(app_state: &Addr<AppState>) -> Result<(), EmgauwaError> {
 | 
				
			||||||
		.await
 | 
							.await
 | 
				
			||||||
		.is_ok();
 | 
							.is_ok();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							let now = EmgauwaNow::now();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		check_weekday(app_state, &mut last_weekday, &mut changed, &now).await?;
 | 
							check_weekday(app_state, &mut last_weekday, &mut changed, &now).await?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if changed {
 | 
							if changed {
 | 
				
			||||||
| 
						 | 
					@ -58,6 +55,12 @@ async fn run_relays(app_state: &Addr<AppState>) -> Result<(), EmgauwaError> {
 | 
				
			||||||
			this = utils::app_state_get_this(app_state).await?;
 | 
								this = utils::app_state_get_this(app_state).await?;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							log::debug!(
 | 
				
			||||||
 | 
								"Relay loop at {}: {}",
 | 
				
			||||||
 | 
								now.time,
 | 
				
			||||||
 | 
								printable_relay_states(&this.get_relay_states())
 | 
				
			||||||
 | 
							);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		duration_override = this
 | 
							duration_override = this
 | 
				
			||||||
			.relays
 | 
								.relays
 | 
				
			||||||
			.iter_mut()
 | 
								.iter_mut()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue