Skip to content

Commit

Permalink
blockchain: fix updateCache (#1786)
Browse files Browse the repository at this point in the history
  • Loading branch information
samlior authored Mar 14, 2022
1 parent b5d9fb0 commit 92587f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/blockchain/src/db/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ export class DBOp {
}

public updateCache(cacheMap: CacheMap) {
if (this.cacheString && cacheMap[this.cacheString] && Buffer.isBuffer(this.baseDBOp.value)) {
if (this.cacheString && cacheMap[this.cacheString]) {
if (this.baseDBOp.type == 'put') {
cacheMap[this.cacheString].set(this.baseDBOp.key, this.baseDBOp.value)
Buffer.isBuffer(this.baseDBOp.value) &&
cacheMap[this.cacheString].set(this.baseDBOp.key, this.baseDBOp.value)
} else if (this.baseDBOp.type == 'del') {
cacheMap[this.cacheString].del(this.baseDBOp.key)
} else {
Expand Down

1 comment on commit 92587f7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 92587f7 Previous: b5d9fb0 Ratio
Block 9422906 10324 ops/sec (±6.61%) 20807 ops/sec (±1.95%) 2.02
Block 9422908 9409 ops/sec (±12.37%) 20419 ops/sec (±1.70%) 2.17

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.