File tree 3 files changed +18
-6
lines changed
3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 1
1
import LRU from "lru-cache" ;
2
2
import * as Sentry from "@sentry/node" ;
3
3
4
- const ttl = 1000 * 60 * 10 ; // 10m
4
+ const maxAge = 1000 * 60 * 10 ; // 10m
5
5
6
6
export default class Pools {
7
7
constructor ( createPool ) {
8
8
this . createPool = createPool ;
9
9
this . cache = new LRU ( {
10
10
max : 100 ,
11
- ttl ,
11
+ maxAge ,
12
12
updateAgeOnGet : true ,
13
13
dispose ( _key , pool ) {
14
14
pool . end ( ) ;
@@ -17,8 +17,8 @@ export default class Pools {
17
17
18
18
let loop ;
19
19
( loop = ( ) => {
20
- this . cache . purgeStale ( ) ;
21
- this . timeout = setTimeout ( loop , ttl / 2 ) ;
20
+ this . cache . prune ( ) ;
21
+ this . timeout = setTimeout ( loop , maxAge / 2 ) ;
22
22
} ) ( ) ;
23
23
}
24
24
@@ -45,7 +45,7 @@ export default class Pools {
45
45
}
46
46
47
47
del ( credentials ) {
48
- this . cache . delete ( JSON . stringify ( credentials ) ) ;
48
+ this . cache . del ( JSON . stringify ( credentials ) ) ;
49
49
}
50
50
51
51
end ( ) {
Original file line number Diff line number Diff line change 22
22
"@sentry/node" : " ^7.33.0" ,
23
23
"JSONStream" : " ^1.3.5" ,
24
24
"ajv" : " ^8.11.0" ,
25
- "lru-cache" : " ^7.14.1 " ,
25
+ "lru-cache" : " ^6.0.0 " ,
26
26
"micro" : " ^9.3.4" ,
27
27
"mssql" : " ^9.0.1" ,
28
28
"mysql2" : " ^3.0.1" ,
Original file line number Diff line number Diff line change @@ -3619,6 +3619,13 @@ lru-cache@^5.1.1:
3619
3619
dependencies :
3620
3620
yallist "^3.0.2"
3621
3621
3622
+ lru-cache@^6.0.0 :
3623
+ version "6.0.0"
3624
+ resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
3625
+ integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
3626
+ dependencies :
3627
+ yallist "^4.0.0"
3628
+
3622
3629
lru-cache@^7.14.1 :
3623
3630
version "7.14.1"
3624
3631
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.14.1.tgz#8da8d2f5f59827edb388e63e459ac23d6d408fea"
@@ -5756,6 +5763,11 @@ yallist@^3.0.2:
5756
5763
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
5757
5764
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
5758
5765
5766
+ yallist@^4.0.0 :
5767
+ version "4.0.0"
5768
+ resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
5769
+ integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
5770
+
5759
5771
5760
5772
version "20.2.4"
5761
5773
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"
You can’t perform that action at this time.
0 commit comments