<commit_before># -*- coding: UTF8

from elite.loader.eddb import apiv4

from datetime import datetime, timedelta
import random


def updateAll(mydb):
    lastImport = mydb.getConfig( 'lastEDDBimport' )

    if lastImport:
        lastImport = datetime.strptime(lastImport, "%Y-%m-%d %H:%M:%S")

        ''' omly update max all 24h or next dey >5 plus random anti ddos
            "not all clients start update at same time
            hope it work ;)" '''
        updatetime = datetime.utcnow().replace(hour=3, minute=30)
        if lastImport < updatetime and datetime.utcnow() > updatetime and random.randint(1, 10) == 1:
            pass
        else:
            return

    print("update from eddb")

    myapiv4 = apiv4.loader(mydb)
    myapiv4.importData()
    del myapiv4

    mydb.setConfig( 'lastEDDBimport', datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") )<commit_msg>disabele eddb loader on exception<commit_after># -*- coding: UTF8

from elite.loader.eddb import apiv4

from datetime import datetime, timedelta
import random
import traceback


def updateAll(mydb):
    lastImport = mydb.getConfig( 'lastEDDBimport' )

    if lastImport:
        lastImport = datetime.strptime(lastImport, "%Y-%m-%d %H:%M:%S")

        ''' omly update max all 24h or next dey >5 plus random anti ddos
            "not all clients start update at same time
            hope it work ;)" '''
        updatetime = datetime.utcnow().replace(hour=3, minute=30)
        if lastImport < updatetime and datetime.utcnow() > updatetime and random.randint(1, 10) == 1:
            pass
        else:
            return

    print("update from eddb")

    try:
        myapiv4 = apiv4.loader(mydb)
        myapiv4.importData()
        del myapiv4
    except:
        traceback.print_exc()
        mydb.setConfig('plugin_eddb', 0)
        print("disable eddb loader!")
    
    mydb.setConfig( 'lastEDDBimport', datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") )
{'fraction_non_alphanumeric': 0.11837364899639732, 'fraction_numerical': 0.016984045290787442, 'mean_word_length': 2.6610169491525424, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '335125', 'n_tokens_mistral': 646, 'n_tokens_neox': 617, 'n_words': 168}