1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-13 17:42:53 +08:00

Add session to list in the end

This commit is contained in:
Marcos Lilljedahl 2017-03-15 17:41:53 -03:00
parent e8903896d1
commit 6fba4f3b3a

View File

@ -230,8 +230,6 @@ func NewSession(duration time.Duration) (*Session, error) {
s.ExpiresAt = s.CreatedAt.Add(duration)
log.Printf("NewSession id=[%s]\n", s.Id)
sessions[s.Id] = s
// Schedule cleanup of the session
CloseSessionAfter(s, duration)
@ -253,6 +251,8 @@ func NewSession(duration time.Duration) (*Session, error) {
// Schedule peridic tasks execution
s.SchedulePeriodicTasks()
sessions[s.Id] = s
// We store sessions as soon as we create one so we don't delete new sessions on an api restart
if err := saveSessionsToDisk(); err != nil {
return nil, err