<commit_before>var stats = require('../voxel-stats');
var ChunkStore = require('../chunk-store');
var mysql = require('mysql');
var zlib = require('zlib');
var HLRU = require('hashlru');
var cache = HLRU(400);
var log = require('../log')('MysqlChunkStore', false);

var worldId = 1;

var MysqlChunkStore = function(generator, config) {
    var self = this;
    ChunkStore.call(this, generator);
    // ChunkID -> chunk data structure
    this.toSave = {};
    this.changes = {};
    this.mysqlPool = mysql.createPool(config);

    setInterval(
        function() {
            self.applyChanges();
            self.save();
        },
        500
    );
};
module.exports = MysqlChunkStore;

<commit_msg>flush to mysql every 5 seconds instead of twice a second<commit_after>var stats = require('../voxel-stats');
var ChunkStore = require('../chunk-store');
var mysql = require('mysql');
var zlib = require('zlib');
var HLRU = require('hashlru');
var cache = HLRU(400);
var log = require('../log')('MysqlChunkStore', false);

var worldId = 1;

var MysqlChunkStore = function(generator, config) {
    var self = this;
    ChunkStore.call(this, generator);
    // ChunkID -> chunk data structure
    this.toSave = {};
    this.changes = {};
    this.mysqlPool = mysql.createPool(config);

    setInterval(
        function() {
            self.applyChanges();
            self.save();
        },
        5000
    );
};
module.exports = MysqlChunkStore;


{'fraction_non_alphanumeric': 0.15724137931034482, 'fraction_numerical': 0.011034482758620689, 'mean_word_length': 2.9536784741144415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7531969', 'n_tokens_mistral': 469, 'n_tokens_neox': 443, 'n_words': 108}