Skip to content

Commit

Permalink
优化A股雷达发送间隔控制
Browse files Browse the repository at this point in the history
  • Loading branch information
iamlaobie committed Oct 16, 2012
1 parent fa5bada commit 2853121
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion send.js
Expand Up @@ -38,12 +38,14 @@ db.loadAccounts(function(err, accounts){

//每小时清空受限账号
//凌晨2点清空a_stock的计数器
//a_stock计时器
var aStockTimer = 0;
setInterval(function(){
if(new Date().getMinutes() % 10 == 0){
limitedAccounts = {};
}
var dt = new Date();
if(dt.getHours() == 2 && dt.getMinutes() == 1){
if((dt.getHours() == 2 && dt.getMinutes() == 1) || Date.now() - aStockTimer > 360000){
redisCli.set('a_stock_counter', 0, function(){});
}
}, 60000);
Expand Down Expand Up @@ -195,6 +197,7 @@ var getAccount = function(blog){
return weiboAccounts[accountKey];
}
var subAstockCounter = function(){
aStockTimer = Date.now();
redisCli.decr('a_stock_counter', function(err, count){
if(count < 0){
redisCli.set('a_stock_counter', 0, function(){});
Expand Down

0 comments on commit 2853121

Please sign in to comment.