mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 12:04:03 +03:00
Correct initialization of antireplay cache
This commit is contained in:
+4
-7
@@ -1,9 +1,6 @@
|
||||
package antireplay
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/allegro/bigcache"
|
||||
|
||||
"github.com/9seconds/mtg/config"
|
||||
@@ -20,15 +17,15 @@ func Has(data []byte) bool {
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func Init() error {
|
||||
func Init() {
|
||||
c, err := bigcache.NewBigCache(bigcache.Config{
|
||||
Shards: 1024,
|
||||
LifeWindow: config.C.AntiReplay.EvictionTime,
|
||||
Hasher: hasher{},
|
||||
HardMaxCacheSize: config.C.AntiReplay.MaxSize,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
cache = c
|
||||
err = fmt.Errorf("qqq: %w", errors.New("tt"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
+1
-3
@@ -60,9 +60,7 @@ func Proxy() error {
|
||||
|
||||
PrintJSONStdout(config.GetURLs())
|
||||
|
||||
if err := antireplay.Init(); err != nil {
|
||||
Fatal(err)
|
||||
}
|
||||
antireplay.Init()
|
||||
if err := stats.Init(ctx); err != nil {
|
||||
Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user