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
Email Patches
Plain Diff
Browse Files
Authored by
姜枫
8 years ago
Commit
72f87dec1b5da9fdcfa19c34d314876b3ff3551e
1 parent
83464663
修复memcached incr的错误
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 @
72f87de
...
...
@@ -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