<commit_before>#include "taskmanager.h"

#include "debug.h"
#include "utils.h"

#include <QDir>
#include <QFileInfo>
#include <QTcpSocket>
#include <QTimer>

#include <TSettings.h>

#define SUCCESS 0

#define NETWORK_HOST "v1-0-0-server.tarsnap.com"
#define NETWORK_PORT 9279
#define NETWORK_UP_SLEEP 60
#define NETWORK_UP_ATTEMPTS 3

TaskManager::TaskManager() : _threadPool(QThreadPool::globalInstance())
{
}

TaskManager::~TaskManager()
{
}

void TaskManager::getTarsnapVersion(QString tarsnapPath)
{
    TarsnapTask *tarsnap = new TarsnapTask();
    if(tarsnapPath.isEmpty())
        tarsnap->setCommand(CMD_TARSNAP);
    else
        tarsnap->setCommand(tarsnapPath + QDir::separator() + CMD_TARSNAP);
    tarsnap->setArguments(QStringList("--version"));
    connect(tarsnap, &TarsnapTask::finished, this,
            &TaskManager::getTarsnapVersionFinished, QUEUED);
    queueTask(tarsnap);
}

void TaskManager::registerMachine(QString user, QString password,
                                  QString machine, QString key,
                                  QString tarsnapPath, QString cachePath)
{
    TarsnapTask *registerTask = new TarsnapTask();
    QStringList  args;<commit_msg>TaskManager: allow extra time for ->deleteLater()<commit_after>#include "taskmanager.h"

#include "debug.h"
#include "utils.h"

#include <QDir>
#include <QFileInfo>
#include <QTcpSocket>
#include <QTimer>

#include <TSettings.h>

#define SUCCESS 0

#define NETWORK_HOST "v1-0-0-server.tarsnap.com"
#define NETWORK_PORT 9279
#define NETWORK_UP_SLEEP 60
#define NETWORK_UP_ATTEMPTS 3

TaskManager::TaskManager() : _threadPool(QThreadPool::globalInstance())
{
}

TaskManager::~TaskManager()
{
    // Wait up to 1 second to delete objects scheduled with ->deleteLater()
    QCoreApplication::processEvents(0, 1000);
}

void TaskManager::getTarsnapVersion(QString tarsnapPath)
{
    TarsnapTask *tarsnap = new TarsnapTask();
    if(tarsnapPath.isEmpty())
        tarsnap->setCommand(CMD_TARSNAP);
    else
        tarsnap->setCommand(tarsnapPath + QDir::separator() + CMD_TARSNAP);
    tarsnap->setArguments(QStringList("--version"));
    connect(tarsnap, &TarsnapTask::finished, this,
            &TaskManager::getTarsnapVersionFinished, QUEUED);
    queueTask(tarsnap);
}

void TaskManager::registerMachine(QString user, QString password,
                                  QString machine, QString key,
                                  QString tarsnapPath, QString cachePath)
{
    TarsnapTask *registerTask = new TarsnapTask();
    QStringList  args;
{'fraction_non_alphanumeric': 0.11535433070866141, 'fraction_numerical': 0.011023622047244094, 'mean_word_length': 4.021739130434782, 'pattern_counts': {'":': 0, '<': 13, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5482062', 'n_tokens_mistral': 900, 'n_tokens_neox': 833, 'n_words': 163}