🐛 bug: fix nil pointer dereference issue on idempotency middleware (#2668)

pull/2675/head
M. Efe Çetin 2023-10-10 09:23:23 +03:00 committed by GitHub
parent 8c69065e83
commit 9292a36e28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -77,7 +77,14 @@ var ConfigDefault = Config{
func configDefault(config ...Config) Config {
// Return default config if nothing provided
if len(config) < 1 {
return ConfigDefault
cfg := ConfigDefault
cfg.Lock = NewMemoryLock()
cfg.Storage = memory.New(memory.Config{
GCInterval: cfg.Lifetime / 2, // Half the lifetime interval
})
return cfg
}
// Override default config