Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
毕凯
8 years ago
Commit
2f7453bbd532e6a23a4653e4c8ce13d51c2e3434
1 parent
80e1991d
路径完善
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
doraemon/middleware/limiter/rules/qps-limit.js
doraemon/middleware/limiter/rules/qps-limit.js
View file @
2f7453b
...
...
@@ -9,7 +9,7 @@ const MAX_QPS_10m = config.maxQps10m;
const
_
=
require
(
'lodash'
);
const
PAGES
=
{
'/product/^\
/(\d+)
\.html/'
:
5
,
'/product/^\
\/(\\d+)\
\.html/'
:
5
,
'/product/list/index'
:
5
,
'/product/index/index'
:
5
,
'/product/search/list'
:
5
...
...
@@ -44,8 +44,8 @@ module.exports = (limiter, policy) => {
let
pageIncr
=
PAGES
[
pageKey
]
||
0
;
if
(
pageIncr
>
0
)
{
cache
.
incrAsync
(
key
,
pageIncr
,
()
=>
{});
cache
.
incrAsync
(
key10m
,
pageIncr
,
()
=>
{});
cache
.
incrAsync
(
key
,
pageIncr
);
cache
.
incrAsync
(
key10m
,
pageIncr
);
}
});
...
...
@@ -54,7 +54,7 @@ module.exports = (limiter, policy) => {
let
result10m
=
results
[
key10m
];
logger
.
debug
(
'qps limiter: '
+
key
+
'@'
+
result
+
' max: '
+
MAX_QPS
);
logger
.
debug
(
'qps limiter: '
+
key10m
+
'@'
+
result10m
+
' max: '
+
MAX_QPS_10m
);
logger
.
debug
(
'qps limiter
10m
: '
+
key10m
+
'@'
+
result10m
+
' max: '
+
MAX_QPS_10m
);
// 默认数据设置
if
(
!
result
&&
!
_
.
isNumber
(
result
))
{
...
...
Please
register
or
login
to post a comment