Fix DB session cleanup (#15697)
The DB session clean up needs to check expiry not created_unix. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
		
							parent
							
								
									a926ff919d
								
							
						
					
					
						commit
						6ebd833780
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -117,6 +117,6 @@ func CountSessions() (int64, error) {
 | 
			
		|||
 | 
			
		||||
// CleanupSessions cleans up expired sessions
 | 
			
		||||
func CleanupSessions(maxLifetime int64) error {
 | 
			
		||||
	_, err := x.Where("created_unix <= ?", timeutil.TimeStampNow().Add(-maxLifetime)).Delete(&Session{})
 | 
			
		||||
	_, err := x.Where("expiry <= ?", timeutil.TimeStampNow().Add(-maxLifetime)).Delete(&Session{})
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue