<commit_before>import {Channel} from '/src/js/model/channel.js';

export class ConfigService {
    constructor (filename, appLifeCycleService) {
        this._configPath = filename;
        this._fs = require("fs");

        this._DEFAULT_THEME = "default";

        this._CONFIG_SAVE_INTERVAL = 30000;

        this._config = this._loadConfig(filename);
        this._ranks = this._loadRanks("templates/" + this._config.theme + "/ranks.json");
        this._appLifeCycleService = appLifeCycleService;
        this._appLifeCycleService.onClose(this._saveConfig.bind(this));
        setInterval(this._saveConfig.bind(this), this._CONFIG_SAVE_INTERVAL);
    }

    getChannels () {
        return this._config.channels || [];
    }
    
    addChannel (type, channelId) {
        const iChannel = this._getChannelIndex(type, channelId);
        if (iChannel >= 0) {
            return;
        }
        this._config.channels = this._config.channels || [];<commit_msg>Remove config saving with timer<commit_after>import {Channel} from '/src/js/model/channel.js';

export class ConfigService {
    constructor (filename, appLifeCycleService) {
        this._configPath = filename;
        this._fs = require("fs");

        this._DEFAULT_THEME = "default";

        this._config = this._loadConfig(filename);
        this._ranks = this._loadRanks("templates/" + this._config.theme + "/ranks.json");
        this._appLifeCycleService = appLifeCycleService;
        this._appLifeCycleService.onClose(this._saveConfig.bind(this));
    }

    getChannels () {
        return this._config.channels || [];
    }
    
    addChannel (type, channelId) {
        const iChannel = this._getChannelIndex(type, channelId);
        if (iChannel >= 0) {
            return;
        }
        this._config.channels = this._config.channels || [];
{'fraction_non_alphanumeric': 0.12370005473453749, 'fraction_numerical': 0.0038314176245210726, 'mean_word_length': 2.7230142566191446, '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': '4418726', 'n_tokens_mistral': 535, 'n_tokens_neox': 521, 'n_words': 90}