<commit_before>const auth = require('./lib/auth');
const jars = require('./lib/jars');

module.exports.run = worker => {
	console.log('>> Worker PID:', process.pid);
	var scServer = worker.scServer;

	/*
	 * In here we handle our incoming realtime connections and listen for events.
	 */

	scServer.on('connection', socket => {
		console.log('Socket connected! :D', socket.authToken);

		socket.on('login', (credentials, res) => {
			console.log('login', credentials);
			auth.login(credentials.ign, credentials.password)
				.then(user => {
					console.log('Login successful', user);
					res(null);
					// Generate JWT
					socket.setAuthToken({
						ign: user.ign,
						scopes: user.scopes
					});
				})
				.catch(err => {
					console.log('Login error', err);
					res(err);
				});
		});

		socket.on('disconnect', () => {
			console.log('Socket disconnect! ;-;');
		});

		socket.on('search', async ({ origin = 'vanilla', query = '' }, res) => {
			console.log('Backend search', origin, query);
			try {
				res(null, await jars.queryJars(origin, query));
			} catch (err) {
				res(err);
			}
		});
	});
};<commit_msg>Cleanup console.log's<commit_after>const auth = require('./lib/auth');
const jars = require('./lib/jars');

module.exports.run = worker => {
	console.log('>> Worker PID:', process.pid);
	var scServer = worker.scServer;

	/*
	 * In here we handle our incoming realtime connections and listen for events.
	 */

	scServer.on('connection', socket => {
		console.log('Socket connected! :D', socket.authToken);

		socket.on('login', (credentials, res) => {
			auth.login(credentials.ign, credentials.password)
				.then(user => {
					res(null);
					// Generate JWT
					socket.setAuthToken({
						ign: user.ign,
						scopes: user.scopes
					});
				})
				.catch(err => {
					console.log('Login error', err);
					res(err);
				});
		});

		socket.on('disconnect', () => {
			console.log('Socket disconnect! ;-;');
		});

		socket.on('search', async ({ origin = 'vanilla', query = '' }, res) => {
			try {
				res(null, await jars.queryJars(origin, query));
			} catch (err) {
				res(err);
			}
		});
	});
};
{'fraction_non_alphanumeric': 0.19243344231667445, 'fraction_numerical': 0.0, 'mean_word_length': 3.026315789473684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '5776822', 'n_tokens_mistral': 863, 'n_tokens_neox': 696, 'n_words': 148}