Skip to content

Commit

Permalink
🐛 bug: fix nil pointer dereference issue on idempotency middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammed Efe Cetin committed Oct 8, 2023
1 parent c89184c commit 631e78d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion middleware/idempotency/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 631e78d

Please sign in to comment.