<commit_before>const express = require('express')
const logger = require('morgan')
const compression = require('compression')
const bodyParser = require('body-parser')
const moment = require('moment')
const timezone = require('moment-timezone')
const huntThemDown = require('./track')

const app = express()
let router = express.Router()

let Datastore = require('nedb-promise')
let sync = new Datastore({ filename: './db/sync.db', autoload: true })
let flights = new Datastore({ filename: './db/flight.db', autoload: true })

sync.insert({ next: moment().tz('Europe/Belgrade').valueOf() })

app.use(compression())
app.use(logger('dev'))
app.disable('x-powered-by')

router.use(bodyParser.urlencoded({ extended: false }))
router.use(bodyParser.json())

router
    .all('/', async (request, response) => {
        response.sendFile(__dirname + '/app/index.html')

        let check = await sync.findOne({})
        let currentTime = moment().tz('Europe/Belgrade')

        if (check.timing < currentTime.valueOf()) {
            let result = {
                currency: 0,
                amount: 0,
            }

            let retry = 3
            while (retry > 0) {
                try {
                    result = await huntThemDown()
                    break
                } catch (o_O) {
                    retry--
                }
            }

            currentTime = moment().tz('Europe/Belgrade')

            result.timing = {<commit_msg>proper checking of next tracker time<commit_after>const express = require('express')
const logger = require('morgan')
const compression = require('compression')
const bodyParser = require('body-parser')
const moment = require('moment')
const timezone = require('moment-timezone')
const huntThemDown = require('./track')

const app = express()
let router = express.Router()

let Datastore = require('nedb-promise')
let sync = new Datastore({ filename: './db/sync.db', autoload: true })
let flights = new Datastore({ filename: './db/flight.db', autoload: true })

sync.insert({ next: moment().tz('Europe/Belgrade').valueOf() })

app.use(compression())
app.use(logger('dev'))
app.disable('x-powered-by')

router.use(bodyParser.urlencoded({ extended: false }))
router.use(bodyParser.json())

router
    .all('/', async (request, response) => {
        response.sendFile(__dirname + '/app/index.html')

        let check = await sync.findOne({})
        let currentTime = moment().tz('Europe/Belgrade')

        if (check.next < currentTime.valueOf()) {
            let result = {
                currency: 0,
                amount: 0,
            }

            let retry = 3
            while (retry > 0) {
                try {
                    result = await huntThemDown()
                    break
                } catch (o_O) {
                    retry--
                }
            }

            currentTime = moment().tz('Europe/Belgrade')

            result.timing = {
{'fraction_non_alphanumeric': 0.14533106960950765, 'fraction_numerical': 0.0027164685908319186, 'mean_word_length': 2.2733333333333334, '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': '1481377', 'n_tokens_mistral': 841, 'n_tokens_neox': 806, 'n_words': 197}