parent
770c1c80b7
commit
d155b792e9
|
@ -15,28 +15,28 @@ require("ep_etherpad-lite/node_modules/npm").load({}, function(er,npm) {
|
||||||
var ueberDB = require("../src/node_modules/ueberdb2");
|
var ueberDB = require("../src/node_modules/ueberdb2");
|
||||||
var log4js = require("../src/node_modules/log4js");
|
var log4js = require("../src/node_modules/log4js");
|
||||||
var dbWrapperSettings = {
|
var dbWrapperSettings = {
|
||||||
"cache": "0", // The cache slows things down when you're mostly writing.
|
"cache": "0", // The cache slows things down when you're mostly writing.
|
||||||
"writeInterval": 0 // Write directly to the database, don't buffer
|
"writeInterval": 0 // Write directly to the database, don't buffer
|
||||||
};
|
};
|
||||||
var db = new ueberDB.database(settings.dbType, settings.dbSettings, dbWrapperSettings, log4js.getLogger("ueberDB"));
|
var db = new ueberDB.database(settings.dbType, settings.dbSettings, dbWrapperSettings, log4js.getLogger("ueberDB"));
|
||||||
|
|
||||||
db.init(function() {
|
db.init(function() {
|
||||||
console.log("Waiting for dirtyDB to parse its file.");
|
console.log("Waiting for dirtyDB to parse its file.");
|
||||||
dirty.on("load", function(length) {
|
dirty.on("load", function(length) {
|
||||||
console.log("Loaded " + length + " records, processing now.");
|
console.log("Loaded " + length + " records, processing now.");
|
||||||
var remaining = length;
|
var remaining = length;
|
||||||
dirty.forEach(function(key, value) {
|
dirty.forEach(function(key, value) {
|
||||||
db.set(key, value, function(error) {
|
db.set(key, value, function(error) {
|
||||||
if (typeof error != 'undefined') {
|
if (typeof error != 'undefined') {
|
||||||
console.log("Unexpected result handling: ", key, value, " was: ", error);
|
console.log("Unexpected result handling: ", key, value, " was: ", error);
|
||||||
}
|
}
|
||||||
remaining -= 1;
|
remaining -= 1;
|
||||||
var oldremaining = remaining;
|
var oldremaining = remaining;
|
||||||
if ((oldremaining % 100) == 0) {
|
if ((oldremaining % 100) == 0) {
|
||||||
console.log("Records not yet flushed to database: ", remaining);
|
console.log("Records not yet flushed to database: ", remaining);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
console.log("Please wait for all records to flush to database, then kill this process.");
|
console.log("Please wait for all records to flush to database, then kill this process.");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue