Browse Source

Session files lifetime--, go mod

Vova Tkach 6 years ago
parent
commit
776f46c581
3 changed files with 3 additions and 2 deletions
  1. 1 0
      go.mod
  2. 1 1
      main.go
  3. 1 1
      session/clean.go

+ 1 - 0
go.mod

@@ -0,0 +1 @@
+module github.com/vladimirok5959/golang-server-sessions

+ 1 - 1
main.go

@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"fmt"
 	"net/http"
 	"net/http"
 
 
-	"golang-server-sessions/session"
+	"github.com/vladimirok5959/golang-server-sessions/session"
 )
 )
 
 
 func main() {
 func main() {

+ 1 - 1
session/clean.go

@@ -12,7 +12,7 @@ func Clean(tmpdir string) error {
 		return err
 		return err
 	}
 	}
 	now := time.Now()
 	now := time.Now()
-	exp := 7 * 24 * time.Hour
+	exp := 24 * time.Hour
 	for _, file := range files {
 	for _, file := range files {
 		if len(file.Name()) == 40 {
 		if len(file.Name()) == 40 {
 			if diff := now.Sub(file.ModTime()); diff > exp {
 			if diff := now.Sub(file.ModTime()); diff > exp {