<commit_before>
var UserManager = $({});
UserManager.MY_NAME_URL = B_HTTP + 'my.name';

$.extend(UserManager, {
    loginWithRetry: function(wait) {
        UserManager.login();
        var current = UserManager.user;
        setTimeout(function() {
            // retry;
            if (!UserManager.user) UserManager.login();
        }, wait || 15 * 1000);
    },
    login: function() {
        $.get(UserManager.MY_NAME_URL).next(function(data) {
            UserManager.loginHandler(JSON.parse(data));
        }).error(UserManager.loginErrorHandler);
    },
    loginHandler: function(res) {
        p('loginHandler');
        UserManager.setUser(res);
    },
    loginErrorHandler: function UserManager_loginErrorHandler(res) {
        p('login error...', res);
        var j = JSON.parse(res.responseText);
        UserManager.setUser(j);
    },
    logout: function UserManager_clearUser () {
        UserManager.clearUser();
    },
    clearUser: function() {
        if (UserManager.user) {
            UserManager.user.clear();
            delete UserManager.user;
        }
    },
    setUser: function UserManager_setCurrentUser (res) {
        if (!res.login) return;
        var current = UserManager.user;
        if (current) {
            if (current.name == res.name) {
                current.options.rks = res.rks;
                current.options.plususer = res.plususer;
                current.options.ignores_regex = res.ignores_regex;
                delete current._ignores;
                return current;<commit_msg>15分ごとにユーザー設定を同期。<commit_after>
var UserManager = $({});
UserManager.MY_NAME_URL = B_HTTP + 'my.name';

$.extend(UserManager, {
    loginWithRetry: function(wait) {
        UserManager.login();
        var current = UserManager.user;
        setTimeout(function() {
            // retry;
            if (!UserManager.user) UserManager.login();
        }, wait || 15 * 1000);
    },
    login: function() {
        $.get(UserManager.MY_NAME_URL).next(function(data) {
            UserManager.loginHandler(JSON.parse(data));
        }).error(UserManager.loginErrorHandler);
    },
    loginHandler: function(res) {
        p('loginHandler');
        UserManager.setUser(res);
    },
    loginErrorHandler: function UserManager_loginErrorHandler(res) {
        p('login error...', res);
        var j = JSON.parse(res.responseText);
        UserManager.setUser(j);
    },
    logout: function UserManager_clearUser () {
        UserManager.clearUser();
    },
    clearUser: function() {
        if (UserManager.user) {
            UserManager.user.clear();
            delete UserManager.user;
        }
    },
    setUser: function UserManager_setCurrentUser (res) {
        if (!res.login) return;
        var current = UserManager.user;
        if (current) {
            if (current.name == res.name) {
                $.extend(current.options, res);
                delete current._ignores;
                return current;
{'fraction_non_alphanumeric': 0.1290431266846361, 'fraction_numerical': 0.0047169811320754715, 'mean_word_length': 2.148462354188759, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3483966', 'n_tokens_mistral': 863, 'n_tokens_neox': 847, 'n_words': 147}