Skip to content

Commit

Permalink
fix: correctly clear timeout in BlockCache class (#353)
Browse files Browse the repository at this point in the history
* fix: correctly clear timeout in BlockCache

* chore: bump version to 1.2.1
  • Loading branch information
JKRhb committed Oct 27, 2022
1 parent ee8762c commit 731d093
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/cache.ts
Expand Up @@ -70,12 +70,11 @@ class BlockCache<T> {
}

remove (key: string): boolean {
if (this._cache.delete(key)) {
if (this.contains(key)) {
debug('remove cache entry, key:', key)
this.clearTimeout(key)
return true
}
return false
return this._cache.delete(key)
}

contains (key: string): boolean {
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "coap",
"version": "1.2.0",
"version": "1.2.1",
"description": "A CoAP library for node modelled after 'http'",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 731d093

Please sign in to comment.