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
efectn authored Oct 10, 2023
1 parent 8c69065 commit 9292a36
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 9292a36

Please sign in to comment.