persist lastSignoff in the database

This commit is contained in:
Shivaram Lingamneni 2020-02-20 02:33:49 -05:00
parent 17a89838b8
commit 4472683d58
3 changed files with 66 additions and 9 deletions

View file

@ -94,6 +94,12 @@ func (client *Client) AllSessionData(currentSession *Session) (data []SessionDat
}
func (client *Client) AddSession(session *Session) (success bool, numSessions int, lastSignoff time.Time) {
defer func() {
if !lastSignoff.IsZero() {
client.wakeWriter()
}
}()
client.stateMutex.Lock()
defer client.stateMutex.Unlock()
@ -111,6 +117,7 @@ func (client *Client) AddSession(session *Session) (success bool, numSessions in
// on the server with no sessions:
lastSignoff = client.lastSignoff
client.lastSignoff = time.Time{}
client.dirtyBits |= IncludeLastSignoff
}
client.sessions = newSessions
return true, len(client.sessions), lastSignoff