mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-07 06:03:09 -06:00
Make less panicky
This commit is contained in:
parent
800dbbf9e4
commit
2488058e62
|
|
@ -78,8 +78,10 @@ type RistrettoCachePartition[K keyable, V any] struct {
|
||||||
|
|
||||||
func (c *RistrettoCachePartition[K, V]) Set(key K, value V) {
|
func (c *RistrettoCachePartition[K, V]) Set(key K, value V) {
|
||||||
if !c.Mutable {
|
if !c.Mutable {
|
||||||
if _, ok := c.cache.Get(key); ok {
|
if v, ok := c.cache.Get(key); ok {
|
||||||
panic(fmt.Sprintf("invalid use of immutable cache tries to replace value of %v", key))
|
if fmt.Sprintf("%v", v) != fmt.Sprintf("%v", value) { // TODO: this is yucky
|
||||||
|
panic(fmt.Sprintf("invalid use of immutable cache tries to replace value of %v", key))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cost := int64(1)
|
cost := int64(1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue