Skip to content

Commit

Permalink
added loadbalancer
Browse files Browse the repository at this point in the history
  • Loading branch information
kvhnuke committed Dec 3, 2016
1 parent abe0a89 commit 285839a
Show file tree
Hide file tree
Showing 6 changed files with 101,351 additions and 91,005 deletions.
20 changes: 2 additions & 18 deletions app/scripts/ajaxReq.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ajaxReq.http = null;
ajaxReq.postSerializer = null;
ajaxReq.SERVERURL = "https://rpc.myetherwallet.com/api.mew";
ajaxReq.COINMARKETCAPAPI = "https://coinmarketcap-nexuist.rhcloud.com/api/";
ajaxReq.pendingPosts = [];
ajaxReq.config = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
Expand Down Expand Up @@ -53,25 +52,10 @@ ajaxReq.getTraceCall = function(txobj, isClassic, callback) {
isClassic: isClassic
}, callback);
}
ajaxReq.queuePost = function() {
var data = this.pendingPosts[0].data;
var callback = this.pendingPosts[0].callback;
this.http.post(this.SERVERURL, this.postSerializer(data), this.config).then(function(data) {
callback(data.data);
ajaxReq.pendingPosts.splice(0, 1);
if (ajaxReq.pendingPosts.length > 0) ajaxReq.queuePost();
});
}
ajaxReq.post = function(data, callback) {
this.pendingPosts.push({
data: data,
callback: function(_data) {
if (_data && _data.error)
_data.msg = globalFuncs.getEthNodeMsg(_data.msg);
callback(_data);
}
this.http.post(this.SERVERURL, this.postSerializer(data), this.config).then(function(data) {
callback(data.data);
});
if (this.pendingPosts.length == 1) this.queuePost();
}
ajaxReq.getETHvalue = function(callback) {
var prefix = "eth";
Expand Down
Loading

0 comments on commit 285839a

Please sign in to comment.