Delete log.Printf() function calls from session_cache.go
This commit is contained in:
parent
c118a238de
commit
39275473af
|
@ -33,7 +33,6 @@ func Init() error {
|
||||||
if err := db.Connect().Find(&dbSessions).Error; err != nil {
|
if err := db.Connect().Find(&dbSessions).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Printf("you what len(dbSessions) = %d", len(dbSessions))
|
|
||||||
for _, dbSession := range dbSessions {
|
for _, dbSession := range dbSessions {
|
||||||
sessionCache.SessionMap[dbSession.ID] = dbSession
|
sessionCache.SessionMap[dbSession.ID] = dbSession
|
||||||
}
|
}
|
||||||
|
@ -43,8 +42,7 @@ func Init() error {
|
||||||
|
|
||||||
func (s *SessiomMapMu) HaveSession(sessionID string) bool {
|
func (s *SessiomMapMu) HaveSession(sessionID string) bool {
|
||||||
s.Mu.RLock()
|
s.Mu.RLock()
|
||||||
val, exists := s.SessionMap[sessionID]
|
_, exists := s.SessionMap[sessionID]
|
||||||
log.Printf("HaveSession s.SessionMap[sessionID] = %v | %b\n", val, exists)
|
|
||||||
s.Mu.RUnlock()
|
s.Mu.RUnlock()
|
||||||
return exists
|
return exists
|
||||||
}
|
}
|
||||||
|
@ -52,14 +50,12 @@ func (s *SessiomMapMu) HaveSession(sessionID string) bool {
|
||||||
func (s *SessiomMapMu) AddSession(session *db.Session) {
|
func (s *SessiomMapMu) AddSession(session *db.Session) {
|
||||||
s.Mu.Lock()
|
s.Mu.Lock()
|
||||||
s.SessionMap[session.ID] = session
|
s.SessionMap[session.ID] = session
|
||||||
log.Printf("AddSession s.SessionMap[sessionID] = %v \n", session)
|
|
||||||
s.Mu.Unlock()
|
s.Mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SessiomMapMu) GetSession(sessionID string) *db.Session {
|
func (s *SessiomMapMu) GetSession(sessionID string) *db.Session {
|
||||||
s.Mu.RLock()
|
s.Mu.RLock()
|
||||||
val, exists := s.SessionMap[sessionID]
|
val, exists := s.SessionMap[sessionID]
|
||||||
log.Printf("GetSession s.SessionMap[sessionID] = %v | %b\n", val, exists)
|
|
||||||
s.Mu.RUnlock()
|
s.Mu.RUnlock()
|
||||||
if !exists {
|
if !exists {
|
||||||
return nil
|
return nil
|
||||||
|
@ -70,7 +66,7 @@ func (s *SessiomMapMu) GetSession(sessionID string) *db.Session {
|
||||||
func generateRandomString(length int) string {
|
func generateRandomString(length int) string {
|
||||||
bytes := make([]byte, length)
|
bytes := make([]byte, length)
|
||||||
if _, err := rand.Read(bytes); err != nil {
|
if _, err := rand.Read(bytes); err != nil {
|
||||||
log.Printf("generateRandomString: %v", err)
|
log.Printf("generateRandomString ERROR: %v", err)
|
||||||
}
|
}
|
||||||
return base64.URLEncoding.EncodeToString(bytes)
|
return base64.URLEncoding.EncodeToString(bytes)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user