Change channel dumping to a single interval rather than per-channel
This commit is contained in:
parent
9193423923
commit
2e77cb4499
6 changed files with 50 additions and 40 deletions
|
|
@ -67,6 +67,18 @@ function initIpThrottleCleanup(Server) {
|
|||
}, 5 * 60 * 1000);
|
||||
}
|
||||
|
||||
function initChannelDumper(Server) {
|
||||
var CHANNEL_SAVE_INTERVAL = Server.cfg["channel-save-interval"] * 60000;
|
||||
setInterval(function () {
|
||||
for (var i = 0; i < Server.channels.length; i++) {
|
||||
var chan = Server.channels[i];
|
||||
if (!chan.dead && chan.users && chan.users.length > 0) {
|
||||
chan.saveDump();
|
||||
}
|
||||
}
|
||||
}, CHANNEL_SAVE_INTERVAL);
|
||||
}
|
||||
|
||||
module.exports = function (Server) {
|
||||
if (init === Server) {
|
||||
Logger.errlog.log("WARNING: Attempted to re-init background tasks");
|
||||
|
|
@ -77,4 +89,5 @@ module.exports = function (Server) {
|
|||
initStats(Server);
|
||||
initAliasCleanup(Server);
|
||||
initIpThrottleCleanup(Server);
|
||||
initChannelDumper(Server);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -276,7 +276,6 @@ Channel.prototype.loadDump = function() {
|
|||
self.js = data.js || "";
|
||||
self.sendAll("channelCSSJS", {css: self.css, js: self.js});
|
||||
self.initialized = true;
|
||||
setTimeout(function() { incrementalDump(self); }, 300000);
|
||||
}
|
||||
catch(e) {
|
||||
Logger.errlog.log("Channel dump load failed: ");
|
||||
|
|
@ -312,14 +311,6 @@ Channel.prototype.saveDump = function() {
|
|||
fs.writeFileSync(path.join(__dirname, "../chandump", this.name), text);
|
||||
}
|
||||
|
||||
// Save channel dumps every 5 minutes, in case of crash
|
||||
function incrementalDump(chan) {
|
||||
if(!chan.dead && chan.users && chan.users.length > 0) {
|
||||
chan.saveDump();
|
||||
setTimeout(function() { incrementalDump(chan); }, 300000);
|
||||
}
|
||||
}
|
||||
|
||||
Channel.prototype.readLog = function (filterIp, callback) {
|
||||
var maxLen = 100000; // Most recent 100KB
|
||||
var file = this.logger.filename;
|
||||
|
|
|
|||
|
|
@ -14,41 +14,42 @@ var Logger = require("./logger");
|
|||
var nodemailer = require("nodemailer");
|
||||
|
||||
var defaults = {
|
||||
"mysql-server" : "localhost",
|
||||
"mysql-db" : "cytube",
|
||||
"mysql-user" : "cytube",
|
||||
"mysql-pw" : "supersecretpass",
|
||||
"express-host" : "0.0.0.0",
|
||||
"io-host" : "0.0.0.0",
|
||||
"enable-ssl" : false,
|
||||
"ssl-keyfile" : "",
|
||||
"ssl-passphrase" : "",
|
||||
"ssl-certfile" : "",
|
||||
"ssl-port" : 443,
|
||||
"asset-cache-ttl" : 0,
|
||||
"web-port" : 8080,
|
||||
"io-port" : 1337,
|
||||
"ip-connection-limit" : 10,
|
||||
"guest-login-delay" : 60,
|
||||
"trust-x-forward" : false,
|
||||
"enable-mail" : false,
|
||||
"mail-transport" : "SMTP",
|
||||
"mail-config" : {
|
||||
"mysql-server" : "localhost",
|
||||
"mysql-db" : "cytube",
|
||||
"mysql-user" : "cytube",
|
||||
"mysql-pw" : "supersecretpass",
|
||||
"express-host" : "0.0.0.0",
|
||||
"io-host" : "0.0.0.0",
|
||||
"enable-ssl" : false,
|
||||
"ssl-keyfile" : "",
|
||||
"ssl-passphrase" : "",
|
||||
"ssl-certfile" : "",
|
||||
"ssl-port" : 443,
|
||||
"asset-cache-ttl" : 0,
|
||||
"web-port" : 8080,
|
||||
"io-port" : 1337,
|
||||
"ip-connection-limit" : 10,
|
||||
"guest-login-delay" : 60,
|
||||
"channel-save-interval" : 5,
|
||||
"trust-x-forward" : false,
|
||||
"enable-mail" : false,
|
||||
"mail-transport" : "SMTP",
|
||||
"mail-config" : {
|
||||
"service" : "Gmail",
|
||||
"auth" : {
|
||||
"user" : "some.user@gmail.com",
|
||||
"pass" : "supersecretpassword"
|
||||
}
|
||||
},
|
||||
"mail-from" : "some.user@gmail.com",
|
||||
"domain" : "http://localhost",
|
||||
"ytv3apikey" : "",
|
||||
"enable-ytv3" : false,
|
||||
"ytv2devkey" : "",
|
||||
"stat-interval" : 3600000,
|
||||
"stat-max-age" : 86400000,
|
||||
"alias-purge-interval": 3600000,
|
||||
"alias-max-age" : 2592000000
|
||||
"mail-from" : "some.user@gmail.com",
|
||||
"domain" : "http://localhost",
|
||||
"ytv3apikey" : "",
|
||||
"enable-ytv3" : false,
|
||||
"ytv2devkey" : "",
|
||||
"stat-interval" : 3600000,
|
||||
"stat-max-age" : 86400000,
|
||||
"alias-purge-interval" : 3600000,
|
||||
"alias-max-age" : 2592000000
|
||||
}
|
||||
|
||||
function save(cfg, file) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
const VERSION = "2.4.3";
|
||||
const VERSION = "2.4.4";
|
||||
var singleton = null;
|
||||
|
||||
module.exports = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue