mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 07:36:44 +00:00
fix error verification
This commit is contained in:
parent
9c4f3b2f8d
commit
06201c3231
2 changed files with 5 additions and 5 deletions
|
|
@ -185,7 +185,7 @@ func (bs *BeaconStorage) getLcUpdateValueByRange(start, end uint64) ([]byte, err
|
|||
func (bs *BeaconStorage) putContentValue(contentId, contentKey, value []byte) error {
|
||||
length := 32 + len(contentKey) + len(value)
|
||||
_, err := bs.db.ExecContext(context.Background(), InsertQueryBeacon, contentId, contentKey, value, length)
|
||||
if metrics.Enabled && err != nil {
|
||||
if metrics.Enabled && err == nil {
|
||||
portalStorageMetrics.EntriesCount.Inc(1)
|
||||
portalStorageMetrics.ContentStorageUsage.Inc(int64(len(value)))
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ func (bs *BeaconStorage) putContentValue(contentId, contentKey, value []byte) er
|
|||
|
||||
func (bs *BeaconStorage) putLcUpdate(period uint64, value []byte) error {
|
||||
_, err := bs.db.ExecContext(context.Background(), InsertLCUpdateQuery, period, value, 0, len(value))
|
||||
if metrics.Enabled && err != nil {
|
||||
if metrics.Enabled && err == nil {
|
||||
portalStorageMetrics.EntriesCount.Inc(1)
|
||||
portalStorageMetrics.ContentStorageUsage.Inc(int64(len(value)))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ func (p *ContentStorage) del(contentId []byte) error {
|
|||
}
|
||||
}
|
||||
_, err = p.delStmt.Exec(contentId)
|
||||
if metrics.Enabled && err != nil {
|
||||
if metrics.Enabled && err == nil {
|
||||
portalStorageMetrics.EntriesCount.Dec(1)
|
||||
portalStorageMetrics.ContentStorageUsage.Dec(int64(sizeDel))
|
||||
}
|
||||
|
|
@ -480,7 +480,7 @@ func (p *ContentStorage) batchDel(ids [][]byte) error {
|
|||
|
||||
// delete items
|
||||
_, err = p.sqliteDB.Exec(query, args...)
|
||||
if metrics.Enabled && err != nil {
|
||||
if metrics.Enabled && err == nil {
|
||||
portalStorageMetrics.EntriesCount.Dec(int64(len(args)))
|
||||
portalStorageMetrics.ContentStorageUsage.Dec(int64(sizeDel))
|
||||
}
|
||||
|
|
@ -509,7 +509,7 @@ func (p *ContentStorage) deleteContentOutOfRadius(radius *uint256.Int) error {
|
|||
}
|
||||
count, err := res.RowsAffected()
|
||||
p.log.Trace("delete items", "count", count)
|
||||
if metrics.Enabled && err != nil {
|
||||
if metrics.Enabled && err == nil {
|
||||
portalStorageMetrics.EntriesCount.Dec(count)
|
||||
portalStorageMetrics.ContentStorageUsage.Dec(int64(sizeDel))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue