Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
周少峰
8 years ago
Commit
0a8d49c93a260c9f7a9aea71ecb8a4e3605f1665
2 parents
23a4f69a
72f87dec
Merge branch 'hotfix/memcached-incr' into hotfix/pz
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
doraemon/middleware/limiter/rules/qps-limit.js
doraemon/middleware/limiter/rules/qps-limit.js
View file @
0a8d49c
...
...
@@ -29,6 +29,8 @@ module.exports = (limiter, policy) => {
const
key
=
`
pc
:
limiter
:
$
{
limiter
.
remoteIp
}
`
;
let
isNew
=
false
;
res
.
on
(
'render'
,
function
()
{
let
route
=
req
.
route
?
req
.
route
.
path
:
''
;
let
appPath
=
req
.
app
.
mountpath
;
...
...
@@ -44,7 +46,7 @@ module.exports = (limiter, policy) => {
pageIncr
=
5
;
}
if
(
pageIncr
>
0
)
{
if
(
pageIncr
>
0
&&
!
isNew
)
{
cache
.
incrAsync
(
key
,
pageIncr
);
}
});
...
...
@@ -70,6 +72,7 @@ module.exports = (limiter, policy) => {
}
}
else
{
cache
.
setAsync
(
key
,
1
,
60
);
// 设置key,1m失效
isNew
=
true
;
return
Promise
.
resolve
(
true
);
}
});
...
...
Please
register
or
login
to post a comment