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 {
 | 
			
		||||
		let now = EmgauwaNow::now();
 | 
			
		||||
		log::debug!(
 | 
			
		||||
			"Relay loop at {}: {}",
 | 
			
		||||
			now.time,
 | 
			
		||||
			printable_relay_states(&this.get_relay_states())
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		let notifier_future = notifier.notified();
 | 
			
		||||
		pin_mut!(notifier_future);
 | 
			
		||||
| 
						 | 
				
			
			@ -51,6 +46,8 @@ async fn run_relays(app_state: &Addr<AppState>) -> Result<(), EmgauwaError> {
 | 
			
		|||
		.await
 | 
			
		||||
		.is_ok();
 | 
			
		||||
 | 
			
		||||
		let now = EmgauwaNow::now();
 | 
			
		||||
 | 
			
		||||
		check_weekday(app_state, &mut last_weekday, &mut changed, &now).await?;
 | 
			
		||||
 | 
			
		||||
		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?;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		log::debug!(
 | 
			
		||||
			"Relay loop at {}: {}",
 | 
			
		||||
			now.time,
 | 
			
		||||
			printable_relay_states(&this.get_relay_states())
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		duration_override = this
 | 
			
		||||
			.relays
 | 
			
		||||
			.iter_mut()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue