<commit_before>var express = require("express");
var app = express();

var http = require("http").Server(app);
var io = require("socket.io")(http);

var aika = 60;
var ongoingCountdown;

var extracted = function (socket) {
    ongoingCountdown = setInterval(function () {
        aika = aika - 1;
        socket.emit("time", aika);
    }, 1000);
}

io.on("connection", function(socket) {
    console.log("Connection hello");
    socket.on("reset", function(){
        console.log("reset");
        aika = 60;
        extracted(socket);
    });
});
<commit_msg>Contert works with one client.<commit_after>var express = require("express");
var app = express();

var http = require("http").Server(app);
var io = require("socket.io")(http);

var aika = 60;
var ongoingCountdown;

var startInterval = function (socket) {
    ongoingCountdown = setInterval(function () {
        aika = aika - 1;
        socket.emit("time", aika);
    }, 1000);
}

io.on("connection", function(socket) {
    console.log("Connection hello");
    socket.on("reset", function(){
        console.log("reset");
        aika = 60;
        if(ongoingCountdown) {
            clearInterval(ongoingCountdown);
        }
        startInterval(socket);
    });
});

{'fraction_non_alphanumeric': 0.16409423233143786, 'fraction_numerical': 0.01462225832656377, 'mean_word_length': 3.1621621621621623, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6547691', 'n_tokens_mistral': 392, 'n_tokens_neox': 374, 'n_words': 84}