@514labs/moose-lib 0.6.252-ci-3-g37e54b29 → 0.6.252-ci-3-gf88b2b20

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.
package/dist/index.mjs CHANGED
@@ -26,6 +26,7 @@ __export(commons_exports, {
26
26
  antiCachePath: () => antiCachePath,
27
27
  cliLog: () => cliLog,
28
28
  compilerLog: () => compilerLog,
29
+ createProducerConfig: () => createProducerConfig,
29
30
  getClickhouseClient: () => getClickhouseClient,
30
31
  getFileName: () => getFileName,
31
32
  getKafkaClient: () => getKafkaClient,
@@ -51,18 +52,25 @@ function isTruthy(value) {
51
52
  function mapTstoJs(filePath) {
52
53
  return filePath.replace(/\.ts$/, ".js").replace(/\.cts$/, ".cjs").replace(/\.mts$/, ".mjs");
53
54
  }
54
- async function getKafkaProducer(cfg, logger) {
55
- const kafka = await getKafkaClient(cfg, logger);
56
- const producer = kafka.producer({
55
+ function createProducerConfig(maxMessageBytes) {
56
+ return {
57
57
  kafkaJS: {
58
- idempotent: true,
58
+ idempotent: false,
59
+ // Not needed for at-least-once delivery
59
60
  acks: ACKs,
60
61
  retry: {
61
62
  retries: MAX_RETRIES_PRODUCER,
62
63
  maxRetryTime: MAX_RETRY_TIME_MS
63
64
  }
64
- }
65
- });
65
+ },
66
+ "linger.ms": 0,
67
+ // Send immediately - batching happens at application level
68
+ ...maxMessageBytes && { "message.max.bytes": maxMessageBytes }
69
+ };
70
+ }
71
+ async function getKafkaProducer(cfg, logger, maxMessageBytes) {
72
+ const kafka = await getKafkaClient(cfg, logger);
73
+ const producer = kafka.producer(createProducerConfig(maxMessageBytes));
66
74
  await producer.connect();
67
75
  return producer;
68
76
  }
@@ -2514,19 +2522,7 @@ var WebApp = class {
2514
2522
  return app.callback();
2515
2523
  }
2516
2524
  if (typeof app.routing === "function") {
2517
- let isReady = false;
2518
- let readyPromise = null;
2519
- if (typeof app.ready === "function") {
2520
- readyPromise = app.ready().then(() => {
2521
- isReady = true;
2522
- });
2523
- } else {
2524
- isReady = true;
2525
- }
2526
- return async (req, res) => {
2527
- if (!isReady && readyPromise) {
2528
- await readyPromise;
2529
- }
2525
+ return (req, res) => {
2530
2526
  app.routing(req, res);
2531
2527
  };
2532
2528
  }
@@ -3309,6 +3305,7 @@ export {
3309
3305
  createClickhouseParameter,
3310
3306
  createConsumptionApi,
3311
3307
  createMaterializedView,
3308
+ createProducerConfig,
3312
3309
  dropView,
3313
3310
  expressMiddleware,
3314
3311
  getApi,