mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-10-04 17:33:21 +08:00
Better session lock management
This commit is contained in:
@@ -59,8 +59,10 @@ func NewSession() (*Session, error) {
|
||||
sessions[s.Id] = s
|
||||
|
||||
// Schedule cleanup of the session
|
||||
time.AfterFunc(4*time.Hour, func() {
|
||||
time.AfterFunc(15*time.Second, func() {
|
||||
s = GetSession(s.Id)
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
wsServer.BroadcastTo(s.Id, "session end")
|
||||
log.Printf("Starting clean up of session [%s]\n", s.Id)
|
||||
for _, i := range s.Instances {
|
||||
|
Reference in New Issue
Block a user