-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Labels
Description
I recently updated ttlcache to v3.4.0 and started seeing this type of error:
goroutine 417 [running]:
runtime/debug.Stack()
/home/lucas/stilingue/go/src/runtime/debug/stack.go:26 +0x6b
github.com/gofiber/fiber/v2/middleware/recover.defaultStackTraceHandler(0xc000489208, {0x1dbc2c0, 0xc000157038})
/home/lucas/go/pkg/mod/github.com/gofiber/fiber/[email protected]/middleware/recover/recover.go:12 +0x37
github.com/gofiber/fiber/v2/middleware/recover.New.func1.1()
/home/lucas/go/pkg/mod/github.com/gofiber/fiber/[email protected]/middleware/recover/recover.go:31 +0x8b
panic({0x1dbc2c0?, 0xc000157038?})
/home/lucas/stilingue/go/src/runtime/panic.go:792 +0x136
github.com/jellydator/ttlcache/v3.(*Cache[...]).updateExpirations(0x208dfe0, 0x0, 0xc00116aff0)
/home/lucas/go/pkg/mod/github.com/jellydator/ttlcache/[email protected]/cache.go:106 +0x38c
github.com/jellydator/ttlcache/v3.(*Cache[...]).set(0x208dfe0, {0xc000dbe000, 0x836}, 0xc000dcae80, 0xdf8475800)
/home/lucas/go/pkg/mod/github.com/jellydator/ttlcache/[email protected]/cache.go:156 +0x165
github.com/jellydator/ttlcache/v3.(*Cache[...]).Set(0x208dfe0, {0xc000dbe000, 0x836}, 0xc000dcae80, 0xdf8475800)
/home/lucas/go/pkg/mod/github.com/jellydator/ttlcache/[email protected]/cache.go:363 +0x125
This might be related to #46.
I'm using a cache loader that can sometimes load the same element concurrently if two requests are performed at the same time for the same user.
My loader:
loader := ttlcache.LoaderFunc[string, *model.MyModel](
func(c *ttlcache.Cache[string, *model.MyModel], key string) *ttlcache.Item[string, *model.MyModel] {
// .. do stuff
item := c.Set(key, value, ttl)
return item
},
)
davseby