garbage collect during cleanup

This commit is contained in:
Michał Adamski 2022-11-09 10:11:53 +01:00
parent 5e49ae530c
commit 58670ea7a7
No known key found for this signature in database
GPG key ID: 4875C0EC4DE5B18A
5 changed files with 7 additions and 3 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
privtracker
config.json
dist
*.fiber.gz

2
go.mod
View file

@ -3,7 +3,7 @@ module privtracker
go 1.15
require (
github.com/gofiber/fiber/v2 v2.29.0
github.com/gofiber/fiber/v2 v2.30.0
github.com/jackpal/bencode-go v1.0.0
github.com/klauspost/compress v1.15.1 // indirect
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd

4
go.sum
View file

@ -1,7 +1,7 @@
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/gofiber/fiber/v2 v2.29.0 h1:wopU1kXxdD9XxvQqYd1vSWMGu2PiZN0yy+DojygTRRA=
github.com/gofiber/fiber/v2 v2.29.0/go.mod h1:1Ega6O199a3Y7yDGuM9FyXDPYQfv+7/y48wl6WCwUF4=
github.com/gofiber/fiber/v2 v2.30.0 h1:R928kgJICQkcfIzAjMIQ+U0uOpa0+vTCZLLODeo4M14=
github.com/gofiber/fiber/v2 v2.30.0/go.mod h1:1Ega6O199a3Y7yDGuM9FyXDPYQfv+7/y48wl6WCwUF4=
github.com/jackpal/bencode-go v1.0.0 h1:lzbSPPqqSfWQnqVNe/BBY1NXdDpncArxShL10+fmFus=
github.com/jackpal/bencode-go v1.0.0/go.mod h1:5FSBQ74yhCl5oQ+QxRPYzWMONFnxbL68/23eezsBI5c=
github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=

View file

@ -31,6 +31,7 @@ func main() {
}
app := fiber.New(config)
app.Use(recover.New())
// app.Use(pprof.New())
app.Use(myLogger())
app.Use(hsts)
app.Get("/", docs)

View file

@ -5,6 +5,7 @@ import (
"crypto/sha1"
"encoding/binary"
"net"
"runtime"
"sync"
"time"
)
@ -163,5 +164,6 @@ func Cleanup() {
}
shard.Unlock()
}
runtime.GC()
}
}