<commit_before>#pragma once

#include "configuration_manager.hpp"
#include "console_user_id_monitor.hpp"
#include "constants.hpp"
#include "frontmost_application_observer.hpp"
#include "gcd_utility.hpp"
#include "grabber_client.hpp"
#include "input_source_observer.hpp"
#include "logger.hpp"
#include "receiver.hpp"
#include "session.hpp"
#include "system_preferences_monitor.hpp"
#include "version_monitor.hpp"
#include <thread>

namespace krbn {
class connection_manager final {
public:
  connection_manager(const connection_manager&) = delete;

  connection_manager(version_monitor& version_monitor) : version_monitor_(version_monitor) {
    console_user_id_monitor_.console_user_id_changed.connect([this](boost::optional<uid_t> uid) {
      version_monitor_.manual_check();
      release();

      if (uid != getuid()) {
        return;
      }

      timer_ = std::make_unique<gcd_utility::fire_while_false_timer>(1 * NSEC_PER_SEC,
                                                                     ^{
                                                                       return setup();
                                                                     });
    });
    console_user_id_monitor_.start();
  }

  ~connection_manager(void) {
    gcd_utility::dispatch_sync_in_main_queue(^{
      release();
    });
<commit_msg>increase interval of setup timer @ console_user_server/connection_manager<commit_after>#pragma once

#include "configuration_manager.hpp"
#include "console_user_id_monitor.hpp"
#include "constants.hpp"
#include "frontmost_application_observer.hpp"
#include "gcd_utility.hpp"
#include "grabber_client.hpp"
#include "input_source_observer.hpp"
#include "logger.hpp"
#include "receiver.hpp"
#include "session.hpp"
#include "system_preferences_monitor.hpp"
#include "version_monitor.hpp"
#include <thread>

namespace krbn {
class connection_manager final {
public:
  connection_manager(const connection_manager&) = delete;

  connection_manager(version_monitor& version_monitor) : version_monitor_(version_monitor) {
    console_user_id_monitor_.console_user_id_changed.connect([this](boost::optional<uid_t> uid) {
      version_monitor_.manual_check();
      release();

      if (uid != getuid()) {
        return;
      }

      timer_ = std::make_unique<gcd_utility::fire_while_false_timer>(3 * NSEC_PER_SEC,
                                                                     ^{
                                                                       return setup();
                                                                     });
    });
    console_user_id_monitor_.start();
  }

  ~connection_manager(void) {
    gcd_utility::dispatch_sync_in_main_queue(^{
      release();
    });

{'fraction_non_alphanumeric': 0.10256410256410256, 'fraction_numerical': 0.0007326007326007326, 'mean_word_length': 2.583989501312336, 'pattern_counts': {'":': 0, '<': 9, '<?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': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '415162', 'n_tokens_mistral': 759, 'n_tokens_neox': 745, 'n_words': 119}