<commit_before>Promise = require 'bluebird'
fs = Promise.promisifyAll(require('fs'))
os = require 'os'
knex = require './db'
utils = require './utils'
{spawn} = require 'child_process'
bootstrap = require './bootstrap'

utils.mixpanelTrack('Supervisor start')

connectivityState = true # Used to prevent multiple messages when disconnected

ensureConnected = (continuous=false) ->
	utils.checkConnectivity()
	.then (connected) ->
		if not connected
			if connectivityState
				console.log('Waiting for connectivity...')
				connectivityState = false
			interval = setInterval(utils.blink,200)
			Promise.delay(1000)
			.then ->
				# Clear the blinks after 1 second
				clearInterval(interval)
				ensureConnected(continuous)
		else<commit_msg>Blink interval of 200ms was too slow to be seen - reverting to 400ms used in api.coffee<commit_after>Promise = require 'bluebird'
fs = Promise.promisifyAll(require('fs'))
os = require 'os'
knex = require './db'
utils = require './utils'
{spawn} = require 'child_process'
bootstrap = require './bootstrap'

utils.mixpanelTrack('Supervisor start')

connectivityState = true # Used to prevent multiple messages when disconnected

ensureConnected = (continuous=false) ->
	utils.checkConnectivity()
	.then (connected) ->
		if not connected
			if connectivityState
				console.log('Waiting for connectivity...')
				connectivityState = false
			interval = setInterval(utils.blink,400)
			Promise.delay(2000)
			.then ->
				# Clear the blinks after 2 second
				clearInterval(interval)
				ensureConnected(continuous)
		else
{'fraction_non_alphanumeric': 0.10755441741357234, 'fraction_numerical': 0.014084507042253521, 'mean_word_length': 4.408304498269896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7099266', 'n_tokens_mistral': 521, 'n_tokens_neox': 441, 'n_words': 132}