forked from overcookedpanda/merit-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
performance increase; txcount setting
- Loading branch information
Luke Williams
committed
Sep 26, 2014
1 parent
11594db
commit b3e2213
Showing
5 changed files
with
74 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require('nodetime').profile({ | ||
accountKey: '823170bf6bf4c8e481c99238999316eec066dce9', | ||
appName: 'IQUIDUS-BENCHMARK' | ||
}); | ||
|
||
var mongoose = require('mongoose') | ||
, db = require('../lib/database') | ||
, Tx = require('../models/tx') | ||
, Address = require('../models/address') | ||
, settings = require('../lib/settings'); | ||
|
||
|
||
var COUNT = 5000; //number of blocks to index | ||
|
||
function exit() { | ||
mongoose.disconnect(); | ||
process.exit(0); | ||
} | ||
|
||
var dbString = "mongodb://" + settings.dbsettings.address; | ||
dbString = dbString + ":" + settings.dbsettings.port; | ||
dbString = dbString + "/IQUIDUS-BENCHMARK"; | ||
|
||
mongoose.connect(dbString, function(err) { | ||
if (err) { | ||
console.log('Unable to connect to database: %s', dbString); | ||
console.log('Aborting'); | ||
exit(); | ||
} | ||
Tx.remove({}, function(err) { | ||
Address.remove({}, function(err2) { | ||
var s_timer = new Date().getTime(); | ||
db.update_tx_db(settings.coin, 1, COUNT, settings.update_timeout, function(){ | ||
var e_timer = new Date().getTime(); | ||
Tx.count({}, function(txerr, txcount){ | ||
Address.count({}, function(aerr, acount){ | ||
var stats = { | ||
tx_count: txcount, | ||
address_count: acount, | ||
seconds: (e_timer - s_timer)/1000, | ||
}; | ||
console.log(stats); | ||
exit(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters