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
27a9a744ce3319ac5f64a0d2ab4b9951c4138bdb
1 parent
fcde36a6
reset synchronize
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
doraemon/middleware/limiter/rules/asynchronous.js
doraemon/middleware/limiter/rules/asynchronous.js
View file @
27a9a74
...
...
@@ -8,7 +8,9 @@ const logger = global.yoho.logger;
const
ASYNCHRONOUSPAGES
=
{
'/product/index/isFavoriteShop'
:
1
,
'/common/suggestfeedback'
:
1
,
'/product/detail/hotarea'
:
1
'/product/detail/hotarea'
:
1
,
'/common/getbanner'
:
1
,
'/passport/cert/headerTip'
:
1
};
function
isNormalSpider
(
userAgent
)
{
...
...
@@ -50,12 +52,13 @@ module.exports = (limiter, policy) => {
// 默认数据设置
if
(
!
results
[
synchronizeKey
]
&&
!
_
.
isNumber
(
results
[
synchronizeKey
]))
{
cache
.
setAsync
(
synchronizeKey
,
1
,
600
);
// 设置key,1m失效
cache
.
setAsync
(
synchronizeKey
,
1
,
600
);
}
// 默认数据设置
if
(
ASYNCHRONOUSPAGES
[
req
.
path
]
>
0
)
{
cache
.
setAsync
(
asynchronousKey
,
1
,
600
);
// 设置key,1m失效
cache
.
setAsync
(
asynchronousKey
,
1
,
600
);
cache
.
setAsync
(
synchronizeKey
,
1
,
600
);
}
if
(
results
[
synchronizeKey
]
>
10
&&
!
results
[
asynchronousKey
])
{
...
...
Please
register
or
login
to post a comment