1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 10:17:26 +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) s.ExpiresAt = s.CreatedAt.Add(duration)
log.Printf("NewSession id=[%s]\n", s.Id) log.Printf("NewSession id=[%s]\n", s.Id)
sessions[s.Id] = s
// Schedule cleanup of the session // Schedule cleanup of the session
CloseSessionAfter(s, duration) CloseSessionAfter(s, duration)
@ -253,6 +251,8 @@ func NewSession(duration time.Duration) (*Session, error) {
// Schedule peridic tasks execution // Schedule peridic tasks execution
s.SchedulePeriodicTasks() 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 // 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 { if err := saveSessionsToDisk(); err != nil {
return nil, err return nil, err