Make use of StateSaveInterval constant
This commit is contained in:
		
							parent
							
								
									bd561cd73a
								
							
						
					
					
						commit
						59b52bfb8c
					
				
							
								
								
									
										4
									
								
								state.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								state.go
									
									
									
									
									
								
							| @ -12,7 +12,7 @@ type ( | |||||||
| 
 | 
 | ||||||
| const ( | const ( | ||||||
| 	StateMetaKey      = "state" | 	StateMetaKey      = "state" | ||||||
| 	StateSaveInterval = 10 | 	StateSaveInterval = 1 // seconds | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func SaveState() { | func SaveState() { | ||||||
| @ -55,7 +55,7 @@ func LoadState() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func KeepStatePersisted() { | func KeepStatePersisted() { | ||||||
| 	t := time.NewTicker(time.Second) | 	t := time.NewTicker(StateSaveInterval * time.Second) | ||||||
| 	for { | 	for { | ||||||
| 		<-t.C | 		<-t.C | ||||||
| 		SaveState() | 		SaveState() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user