Commit f45a7fc4d18d61bb257f0e18163efdc19b3ff69e

Authored by Adhidarma Hadiwinoto
1 parent b38ca9db7e
Exists in master

keepalive_interval

Showing 1 changed file with 6 additions and 5 deletions Side-by-side Diff

... ... @@ -3,7 +3,6 @@ var config = iniparser.parseSync('./config.ini');
3 3  
4 4 var strftime = require('strftime');
5 5  
6   -var POLLING_INTERVAL = 3600 * 1000;
7 6 var pollingTimer;
8 7  
9 8 var lastDataOnPM;
... ... @@ -30,12 +29,12 @@ function broadcast(destinations, message) {
30 29 }
31 30 }
32 31  
33   -var pollingLoop = function() {
  32 +var keepAliveLoop = function() {
34 33 logger.info('Polling loop');
35 34  
36   - absen();
  35 + YahooMessenger.keepAlive();
37 36  
38   - pollingTimer = setTimeout(pollingLoop, POLLING_INTERVAL);
  37 + pollingTimer = setTimeout(keepAliveLoop, config.yahoomessenger.keepalive_interval * 1000);
39 38 }
40 39  
41 40 function insertMessages(db_connection, logger_id, direction, partner, message, sentdate) {
... ... @@ -77,7 +76,9 @@ YahooMessenger.on('loginSuccessful', function onLoginSuccessful(data){
77 76 YahooMessenger.setCustomAwayStatus(config.yahoomessenger.status);
78 77 };
79 78  
80   - pollingLoop();
  79 + absen();
  80 +
  81 + keepAliveLoop();
81 82 });
82 83  
83 84 YahooMessenger.on('pm', function(data){