reduce gorutines
This commit is contained in:
parent
0cd5a093d5
commit
9758d8508b
|
@ -302,18 +302,14 @@ func (sessions *wSessions) New(httpSession *sessions.Session, sid string) *WideS
|
||||||
mutex.Lock()
|
mutex.Lock()
|
||||||
defer mutex.Unlock()
|
defer mutex.Unlock()
|
||||||
|
|
||||||
now := time.Now()
|
|
||||||
|
|
||||||
// create user event queue
|
|
||||||
userEventQueue := event.UserEventQueues.New(sid)
|
|
||||||
|
|
||||||
username := httpSession.Values["username"].(string)
|
username := httpSession.Values["username"].(string)
|
||||||
|
now := time.Now()
|
||||||
|
|
||||||
ret := &WideSession{
|
ret := &WideSession{
|
||||||
ID: sid,
|
ID: sid,
|
||||||
Username: username,
|
Username: username,
|
||||||
HTTPSession: httpSession,
|
HTTPSession: httpSession,
|
||||||
EventQueue: userEventQueue,
|
EventQueue: nil,
|
||||||
State: sessionStateActive,
|
State: sessionStateActive,
|
||||||
Content: &conf.LatestSessionContent{},
|
Content: &conf.LatestSessionContent{},
|
||||||
Created: now,
|
Created: now,
|
||||||
|
@ -326,9 +322,11 @@ func (sessions *wSessions) New(httpSession *sessions.Session, sid string) *WideS
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create user event queue
|
||||||
|
ret.EventQueue = event.UserEventQueues.New(sid)
|
||||||
|
|
||||||
// add a filesystem watcher to notify front-end after the files changed
|
// add a filesystem watcher to notify front-end after the files changed
|
||||||
watcher, err := fsnotify.NewWatcher()
|
watcher, err := fsnotify.NewWatcher()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue