Skip to content

Commit

Permalink
build(deps): replace tiny-lru with toad-cache (#124)
Browse files Browse the repository at this point in the history
* toad-cache

* use FifoObject
  • Loading branch information
gurgunday authored Jan 19, 2024
1 parent ceab740 commit 91ce108
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const fp = require('fastify-plugin')
const lru = require('tiny-lru').lru
const { FifoObject } = require('toad-cache')
const createError = require('@fastify/error')

const OPEN = Symbol('open')
Expand All @@ -17,7 +17,7 @@ function fastifyCircuitBreaker (fastify, opts, next) {
const circuitOpenErrorMessage = opts.circuitOpenErrorMessage || 'Circuit open'
const onCircuitOpen = opts.onCircuitOpen
const onTimeout = opts.onTimeout
const cache = lru(opts.cache || 500)
const cache = new FifoObject(opts.cache || 500)

let routeId = 0

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"dependencies": {
"@fastify/error": "^3.0.0",
"fastify-plugin": "^4.0.0",
"tiny-lru": "^11.0.0"
"toad-cache": "^3.7.0"
},
"bugs": {
"url": "https://github.com/fastify/fastify-circuit-breaker/issues"
Expand Down

0 comments on commit 91ce108

Please # to comment.