<commit_before>#!/usr/bin/env coffee

app = module.exports = (params) ->
    params = params || {}
    # specify current dir as default root of server
    params.root = params.root || __dirname
    return require('compound').createServer(params)

if not module.parent
    port = process.env.PORT || 9875
    host = process.env.HOST || "127.0.0.1"
    server = app()
    server.listen port, host, ->
        console.log(
            "Compound server listening on %s:%d within %s environment",
            host, port, server.set('env'))

        setIntervalWithContext = (code,delay,context) ->
            setInterval(() ->
                code.call(context)
            ,delay)

        checkAllAccounts = () ->

            # check all accounts
            BankAccount   = server.models.BankAccount
            async         = require "async"

            console.log "Checking bank accounts"

            BankAccount.all (err, bankaccounts) ->
                if err
                    console.log "Error, could not get accounts to check"
                else
                    treatment = (ba, callback) ->
                        #console.log "Periodically checking " + ba.title + " for new operations"
                        BankAccount.getOperations ba, callback

                    async.eachSeries bankaccounts, treatment, (err) ->
                        if not err
                            console.log "Successfully checked all accounts"
                        else
                            console.log "ERROR could not check accounts"

        #setIntervalWithContext checkAllAccounts, 1000 * 60 * 60 * 24, @
        setIntervalWithContext checkAllAccounts, 1000 * 60 * 60, @
        checkAllAccounts()<commit_msg>Periodical cehck every 24 hours<commit_after>#!/usr/bin/env coffee

app = module.exports = (params) ->
    params = params || {}
    # specify current dir as default root of server
    params.root = params.root || __dirname
    return require('compound').createServer(params)

if not module.parent
    port = process.env.PORT || 9875
    host = process.env.HOST || "127.0.0.1"
    server = app()
    server.listen port, host, ->
        console.log(
            "Compound server listening on %s:%d within %s environment",
            host, port, server.set('env'))

        setIntervalWithContext = (code,delay,context) ->
            setInterval(() ->
                code.call(context)
            ,delay)

        checkAllAccounts = () ->

            # check all accounts
            BankAccount   = server.models.BankAccount
            async         = require "async"

            console.log "Checking bank accounts"

            BankAccount.all (err, bankaccounts) ->
                if err
                    console.log "Error, could not get accounts to check"
                else
                    treatment = (ba, callback) ->
                        #console.log "Periodically checking " + ba.title + " for new operations"
                        BankAccount.getOperations ba, callback

                    async.eachSeries bankaccounts, treatment, (err) ->
                        if not err
                            console.log "Successfully checked all accounts"
                        else
                            console.log "ERROR could not check accounts"

        setIntervalWithContext checkAllAccounts, 1000 * 60 * 60 * 24, @
        #setIntervalWithContext checkAllAccounts, 1000 * 60 * 60, @
        checkAllAccounts()
{'fraction_non_alphanumeric': 0.09163802978235967, 'fraction_numerical': 0.016609392898052692, 'mean_word_length': 1.6164794007490637, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7607919', 'n_tokens_mistral': 920, 'n_tokens_neox': 837, 'n_words': 247}