forked from NYANDEV/forgejo
When reading expired sessions - expire them (#12686)
* When reading expired sessions - expire them Update to latest macaron/session following merge of https://gitea.com/macaron/session/pulls/11 Also remove old memory provider as 11 updates the memory provider to make it unnecessary. Signed-off-by: Andrew Thornton <art27@cantab.net> * and macaron/session/pulls/12 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
ed81a95a84
commit
5fd9f72104
9 changed files with 32 additions and 231 deletions
8
vendor/gitea.com/macaron/session/file.go
generated
vendored
8
vendor/gitea.com/macaron/session/file.go
generated
vendored
|
@ -133,7 +133,15 @@ func (p *FileProvider) Read(sid string) (_ RawStore, err error) {
|
|||
defer p.lock.RUnlock()
|
||||
|
||||
var f *os.File
|
||||
ok := false
|
||||
if com.IsFile(filename) {
|
||||
modTime, err := com.FileMTime(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ok = (modTime + p.maxlifetime) >= time.Now().Unix()
|
||||
}
|
||||
if ok {
|
||||
f, err = os.OpenFile(filename, os.O_RDONLY, 0600)
|
||||
} else {
|
||||
f, err = os.Create(filename)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue