move cleanup session
This commit is contained in:
@@ -289,26 +289,6 @@ func logoHandler(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, serverConfig.StyleConfig.LogoPath)
|
||||
}
|
||||
|
||||
func cleanupSessions() {
|
||||
logging.Debug("Cleaning up stale session\n")
|
||||
|
||||
sessionMutex.Lock()
|
||||
sessions_to_delete := []string{}
|
||||
for session_token, session_data := range sessions {
|
||||
timeUntilRemoval := time.Minute * 5
|
||||
if session_data.loggedIn {
|
||||
timeUntilRemoval = time.Hour
|
||||
}
|
||||
if time.Since(session_data.timeCreated) > timeUntilRemoval {
|
||||
sessions_to_delete = append(sessions_to_delete, session_token)
|
||||
}
|
||||
}
|
||||
sessionMutex.Unlock()
|
||||
for _, session_id := range sessions_to_delete {
|
||||
deleteSession(session_id)
|
||||
}
|
||||
}
|
||||
|
||||
func changePasswordHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user