@514labs/moose-lib 0.6.260-ci-3-g63948580 → 0.6.260-ci-2-g1b93253f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  var commons_exports = {};
35
35
  __export(commons_exports, {
36
36
  ACKs: () => ACKs,
37
+ LogLevel: () => LogLevel,
37
38
  MAX_RETRIES: () => MAX_RETRIES,
38
39
  MAX_RETRIES_PRODUCER: () => MAX_RETRIES_PRODUCER,
39
40
  MAX_RETRY_TIME_MS: () => MAX_RETRY_TIME_MS,
@@ -62,6 +63,36 @@ function isTruthy(value) {
62
63
  return false;
63
64
  }
64
65
  }
66
+ function parseLogLevel(value) {
67
+ if (!value) return "Info" /* Info */;
68
+ const normalized = value.trim();
69
+ switch (normalized) {
70
+ case "Debug":
71
+ case "debug":
72
+ case "DEBUG":
73
+ return "Debug" /* Debug */;
74
+ case "Info":
75
+ case "info":
76
+ case "INFO":
77
+ return "Info" /* Info */;
78
+ case "Warn":
79
+ case "warn":
80
+ case "WARN":
81
+ return "Warn" /* Warn */;
82
+ case "Error":
83
+ case "error":
84
+ case "ERROR":
85
+ return "Error" /* Error */;
86
+ default:
87
+ return "Info" /* Info */;
88
+ }
89
+ }
90
+ function getLogLevel() {
91
+ if (cachedLogLevel === null) {
92
+ cachedLogLevel = parseLogLevel(process.env.MOOSE_LOGGER__LEVEL);
93
+ }
94
+ return cachedLogLevel;
95
+ }
65
96
  function mapTstoJs(filePath) {
66
97
  return filePath.replace(/\.ts$/, ".js").replace(/\.cts$/, ".cjs").replace(/\.mts$/, ".mjs");
67
98
  }
@@ -87,7 +118,7 @@ async function getKafkaProducer(cfg, logger, maxMessageBytes) {
87
118
  await producer.connect();
88
119
  return producer;
89
120
  }
90
- var import_http, import_client, import_kafka_javascript, Kafka, compilerLog, antiCachePath, getFileName, getClickhouseClient, cliLog, MAX_RETRIES, MAX_RETRY_TIME_MS, RETRY_INITIAL_TIME_MS, MAX_RETRIES_PRODUCER, RETRY_FACTOR_PRODUCER, ACKs, parseBrokerString, logError, buildSaslConfig, getKafkaClient;
121
+ var import_http, import_client, import_kafka_javascript, Kafka, LogLevel, cachedLogLevel, compilerLog, antiCachePath, getFileName, getClickhouseClient, cliLog, MAX_RETRIES, MAX_RETRY_TIME_MS, RETRY_INITIAL_TIME_MS, MAX_RETRIES_PRODUCER, RETRY_FACTOR_PRODUCER, ACKs, parseBrokerString, logError, buildSaslConfig, getKafkaClient;
91
122
  var init_commons = __esm({
92
123
  "src/commons.ts"() {
93
124
  "use strict";
@@ -95,8 +126,26 @@ var init_commons = __esm({
95
126
  import_client = require("@clickhouse/client");
96
127
  import_kafka_javascript = require("@confluentinc/kafka-javascript");
97
128
  ({ Kafka } = import_kafka_javascript.KafkaJS);
98
- compilerLog = (message) => {
99
- if (!isTruthy(process.env.MOOSE_DISABLE_COMPILER_LOGS)) {
129
+ LogLevel = /* @__PURE__ */ ((LogLevel2) => {
130
+ LogLevel2["Debug"] = "Debug";
131
+ LogLevel2["Info"] = "Info";
132
+ LogLevel2["Warn"] = "Warn";
133
+ LogLevel2["Error"] = "Error";
134
+ return LogLevel2;
135
+ })(LogLevel || {});
136
+ cachedLogLevel = null;
137
+ compilerLog = (message, level = "Debug" /* Debug */) => {
138
+ if (isTruthy(process.env.MOOSE_DISABLE_COMPILER_LOGS)) {
139
+ return;
140
+ }
141
+ const currentLevel = getLogLevel();
142
+ const levelPriority = {
143
+ ["Debug" /* Debug */]: 0,
144
+ ["Info" /* Info */]: 1,
145
+ ["Warn" /* Warn */]: 2,
146
+ ["Error" /* Error */]: 3
147
+ };
148
+ if (levelPriority[level] >= levelPriority[currentLevel]) {
100
149
  console.log(message);
101
150
  }
102
151
  };
@@ -124,7 +173,17 @@ var init_commons = __esm({
124
173
  username,
125
174
  password,
126
175
  database,
127
- application: "moose"
176
+ application: "moose",
177
+ // Connection pool configuration for high load (100+ concurrent users)
178
+ max_open_connections: 50,
179
+ // Increased from default 10 to handle 100 concurrent users
180
+ request_timeout: 6e4,
181
+ // 60s timeout for HTTP requests (queries and inserts)
182
+ keep_alive: {
183
+ enabled: true,
184
+ idle_socket_ttl: 2e3
185
+ // 2s idle time (lower than default to prevent socket hang-ups)
186
+ }
128
187
  // Note: wait_end_of_query is configured per operation type, not globally
129
188
  // to preserve SELECT query performance while ensuring INSERT/DDL reliability
130
189
  });