Authored by 周少峰

Merge branch 'hotfix/incr-error' into 'master'

fix memcached incr



See merge request !86
... ... @@ -64,7 +64,7 @@ const homeNav = (req) => {
{name: '我的信息', href: '/home/message', count: 0},
{
name: '在线客服',
href: _.get(req.app.locals.pc, 'clientService.new', false) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client',
href: _.get(req.app.locals.pc, 'clientService.new', false) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client',
isBlank: true
}
]
... ...
... ... @@ -29,8 +29,6 @@ module.exports = (limiter, policy) => {
const key = `pc:limiter:${limiter.remoteIp}`;
let isNew = true;
res.on('render', function() {
let route = req.route ? req.route.path : '';
let appPath = req.app.mountpath;
... ... @@ -46,15 +44,14 @@ module.exports = (limiter, policy) => {
pageIncr = 5;
}
if (pageIncr > 0 && !isNew) {
cache.incrAsync(key, pageIncr);
if (pageIncr > 0) {
cache.incr(key, pageIncr, (err) => {});
}
});
return cache.getAsync(key).then((result) => {
logger.debug('qps limiter: ' + key + '@' + result + ' max: ' + MAX_QPS);
if (result && _.isNumber(result)) {
isNew = false;
if (result === -1) {
return Promise.resolve(true);
}
... ...
... ... @@ -189,7 +189,7 @@
</div>
<div class="left">
<span class="iconfont rgbf">&#xe602;</span>
<a href="{{#if @root.pc.clientService.new}}http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&amp;configID=149091&amp;jid=8732423409{{else}}/service/client{{/if}}" target="_blank">
<a href="{{#if @root.pc.clientService.new}}http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409{{else}}/service/client{{/if}}" target="_blank">
<span class="red">便捷</span>
<span class="rgbf">在线客服</span>
</a>
... ...