Browse Source

use extended dhtget timeout parameters for mentions and hashtags (requires twister_core >= 0.9.14)

master
Miguel Freitas 11 years ago
parent
commit
72782cea6c
  1. 3
      twister_actions.js
  2. 12
      twister_io.js
  3. 3
      twister_newmsgs.js

3
twister_actions.js

@ -194,7 +194,8 @@ function requestHashtag(postboard,hashtag,resource) {
dhtget( hashtag, resource, "m", dhtget( hashtag, resource, "m",
function(args, data) { function(args, data) {
processHashtag(args.postboard, args.hashtag, data); processHashtag(args.postboard, args.hashtag, data);
}, {postboard:postboard,hashtag:hashtag} ); }, {postboard:postboard,hashtag:hashtag},
[10000,2000,3]); // use extended timeout parameters (requires twister_core >= 0.9.14)
} }

12
twister_io.js

@ -89,7 +89,7 @@ function _dhtgetAbortPending(locator)
// get data from dht resource // get data from dht resource
// the value ["v"] is extracted from response and returned to callback // the value ["v"] is extracted from response and returned to callback
// null is passed to callback in case of an error // null is passed to callback in case of an error
function dhtget( username, resource, multi, cbFunc, cbArg ) { function dhtget( username, resource, multi, cbFunc, cbArg, timeoutArgs ) {
var locator = _dhtgetLocator(username, resource, multi); var locator = _dhtgetLocator(username, resource, multi);
if( locator in _dhtgetPendingMap) { if( locator in _dhtgetPendingMap) {
_dhtgetAddPending(locator, cbFunc, cbArg); _dhtgetAddPending(locator, cbFunc, cbArg);
@ -98,7 +98,7 @@ function dhtget( username, resource, multi, cbFunc, cbArg ) {
// limit the number of simultaneous dhtgets. // limit the number of simultaneous dhtgets.
// this should leave some sockets for other non-blocking daemon requests. // this should leave some sockets for other non-blocking daemon requests.
if( _dhtgetsInProgress < _maxDhtgets ) { if( _dhtgetsInProgress < _maxDhtgets ) {
_dhtgetInternal( username, resource, multi ); _dhtgetInternal( username, resource, multi, timeoutArgs );
} else { } else {
// just queue the locator. it will be unqueue when some dhtget completes. // just queue the locator. it will be unqueue when some dhtget completes.
_queuedDhtgets.push(locator); _queuedDhtgets.push(locator);
@ -106,10 +106,14 @@ function dhtget( username, resource, multi, cbFunc, cbArg ) {
} }
} }
function _dhtgetInternal( username, resource, multi ) { function _dhtgetInternal( username, resource, multi, timeoutArgs ) {
var locator = _dhtgetLocator(username, resource, multi); var locator = _dhtgetLocator(username, resource, multi);
_dhtgetsInProgress++; _dhtgetsInProgress++;
twisterRpc("dhtget", [username,resource,multi], argsList = [username,resource,multi];
if( typeof timeoutArgs !== 'undefined' ) {
argsList = argsList.concat(timeoutArgs);
}
twisterRpc("dhtget", argsList,
function(args, ret) { function(args, ret) {
_dhtgetsInProgress--; _dhtgetsInProgress--;
_dhtgetProcessPending(args.locator, args.multi, ret); _dhtgetProcessPending(args.locator, args.multi, ret);

3
twister_newmsgs.js

@ -69,7 +69,8 @@ function requestMentionsCount() {
} }
$.MAL.updateNewMentionsUI(_newMentions); $.MAL.updateNewMentionsUI(_newMentions);
} }
}, {}); }, {},
[10000,2000,3]); // use extended timeout parameters (requires twister_core >= 0.9.14)
} }
function resetMentionsCount() { function resetMentionsCount() {

Loading…
Cancel
Save