Skip to content

Commit

Permalink
Fix: avoid hard typecast panic
Browse files Browse the repository at this point in the history
  • Loading branch information
yunginnanet committed Jul 4, 2024
1 parent 4c46f0f commit 1312a9a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pogreb/pogreb.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ func (db *DB) Meta() models.Metadata {
db.meta.Extra = make(map[string]interface{})
}
newMet := CombineMetrics(mets...)
if db.meta.Extra["metrics"] == nil || !newMet.Equal(db.meta.Extra["metrics"].(*CombinedMetrics)) {
db.meta.Extra["metrics"] = newMet
_ = db.meta.Sync()
_, metValMapOK := db.meta.Extra["metrics"].(*CombinedMetrics)
_, metValMapMapOK := db.meta.Extra["metrics"].(map[string]interface{})
if metValMapOK {
if metValMapMapOK || !newMet.Equal(db.meta.Extra["metrics"].(*CombinedMetrics)) {
db.meta.Extra["metrics"] = newMet
_ = db.meta.Sync()
}
}
}
m := db.meta
Expand Down

0 comments on commit 1312a9a

Please sign in to comment.