mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-28 10:51:44 +01:00 
			
		
		
		
	Do not setLastStateChangeToNow every 5 seconds
This commit is contained in:
		
							parent
							
								
									28efd92fca
								
							
						
					
					
						commit
						843e2bd9b6
					
				
							
								
								
									
										4
									
								
								app.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								app.go
									
									
									
									
									
								
							@ -292,11 +292,13 @@ func (h *Headscale) expireEphemeralNodesWorker() {
 | 
				
			|||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							expiredFound := false
 | 
				
			||||||
		for _, machine := range machines {
 | 
							for _, machine := range machines {
 | 
				
			||||||
			if machine.AuthKey != nil && machine.LastSeen != nil &&
 | 
								if machine.AuthKey != nil && machine.LastSeen != nil &&
 | 
				
			||||||
				machine.AuthKey.Ephemeral &&
 | 
									machine.AuthKey.Ephemeral &&
 | 
				
			||||||
				time.Now().
 | 
									time.Now().
 | 
				
			||||||
					After(machine.LastSeen.Add(h.cfg.EphemeralNodeInactivityTimeout)) {
 | 
										After(machine.LastSeen.Add(h.cfg.EphemeralNodeInactivityTimeout)) {
 | 
				
			||||||
 | 
									expiredFound = true
 | 
				
			||||||
				log.Info().
 | 
									log.Info().
 | 
				
			||||||
					Str("machine", machine.Name).
 | 
										Str("machine", machine.Name).
 | 
				
			||||||
					Msg("Ephemeral client removed from database")
 | 
										Msg("Ephemeral client removed from database")
 | 
				
			||||||
@ -311,9 +313,11 @@ func (h *Headscale) expireEphemeralNodesWorker() {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if expiredFound {
 | 
				
			||||||
			h.setLastStateChangeToNow(namespace.Name)
 | 
								h.setLastStateChangeToNow(namespace.Name)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (h *Headscale) grpcAuthenticationInterceptor(ctx context.Context,
 | 
					func (h *Headscale) grpcAuthenticationInterceptor(ctx context.Context,
 | 
				
			||||||
	req interface{},
 | 
						req interface{},
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user