(
private port: number,
private host = "0.0.0.0"
)
| 613 | #delayThresholdInMs: number; |
| 614 | |
| 615 | constructor( |
| 616 | private port: number, |
| 617 | private host = "0.0.0.0" |
| 618 | ) { |
| 619 | this.#httpServer = this.#createHttpServer(); |
| 620 | this.#checkpointer.initialize(); |
| 621 | this.#delayThresholdInMs = this.#getDelayThreshold(); |
| 622 | |
| 623 | if (process.env.DELAY_THRESHOLD_IN_MS) { |
| 624 | this.#delayThresholdInMs = this.#getDelayThreshold(); |
| 625 | } |
| 626 | |
| 627 | const io = new Server(this.#httpServer); |
| 628 | this.#prodWorkerNamespace = this.#createProdWorkerNamespace(io); |
| 629 | |
| 630 | this.#platformSocket = this.#createPlatformSocket(); |
| 631 | |
| 632 | const connectedTasksTotal = new Gauge({ |
| 633 | name: "daemon_connected_tasks_total", // don't change this without updating dashboard config |
| 634 | help: "The number of tasks currently connected.", |
| 635 | collect: () => { |
| 636 | connectedTasksTotal.set(this.#prodWorkerNamespace.namespace.sockets.size); |
| 637 | }, |
| 638 | }); |
| 639 | register.registerMetric(connectedTasksTotal); |
| 640 | } |
| 641 | |
| 642 | #getDelayThreshold() { |
| 643 | if (!process.env.RETRY_DELAY_THRESHOLD_IN_MS) { |
nothing calls this directly
no test coverage detected