mirror of https://github.com/calzoneman/sync.git
Change channel dumping to a single interval rather than per-channel
This commit is contained in:
parent
9193423923
commit
2e77cb4499
|
@ -1,3 +1,8 @@
|
|||
Mon Oct 14 16:37 2013 CDT
|
||||
* lib/bgtask.js: Add an interval for dumping all loaded channels
|
||||
* lib/channel.js: Remove per-channel dump interval
|
||||
* lib/config.js: Add config key for channel save interval
|
||||
|
||||
Mon Oct 14 16:30 2013 CDT
|
||||
* lib/server.js: Rate-limit socket.io connections
|
||||
* lib/bgtask.js: Periodically clear out old rate limiters
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"author": "Calvin Montgomery",
|
||||
"name": "CyTube",
|
||||
"description": "Online media synchronizer and chat",
|
||||
"version": "2.4.3",
|
||||
"version": "2.4.4",
|
||||
"repository": {
|
||||
"url": "http://github.com/calzoneman/sync"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue