@rmdes/indiekit-endpoint-conversations 2.4.1 → 2.4.2

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.
Files changed (2) hide show
  1. package/index.js +20 -10
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -2,6 +2,7 @@ import path from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
3
 
4
4
  import express from "express";
5
+ import { waitForReady } from "@rmdes/indiekit-startup-gate";
5
6
 
6
7
  import { conversationsController } from "./lib/controllers/conversations.js";
7
8
  import { createIndexes } from "./lib/storage/conversation-items.js";
@@ -120,16 +121,25 @@ export default class ConversationsEndpoint {
120
121
 
121
122
  // Always start polling — the scheduler detects available sources
122
123
  // at runtime (Mastodon/Bluesky from env vars, AP from collections)
123
- import("./lib/polling/scheduler.js")
124
- .then(({ startPolling }) => {
125
- startPolling(Indiekit, this.options);
126
- })
127
- .catch((error) => {
128
- console.error(
129
- "[Conversations] Polling scheduler failed to start:",
130
- error.message,
131
- );
132
- });
124
+ this._stopGate = waitForReady(
125
+ () => {
126
+ import("./lib/polling/scheduler.js")
127
+ .then(({ startPolling }) => {
128
+ startPolling(Indiekit, this.options);
129
+ })
130
+ .catch((error) => {
131
+ console.error(
132
+ "[Conversations] Polling scheduler failed to start:",
133
+ error.message,
134
+ );
135
+ });
136
+ },
137
+ { label: "Conversations" },
138
+ );
133
139
  }
134
140
  }
141
+
142
+ destroy() {
143
+ this._stopGate?.();
144
+ }
135
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-conversations",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Conversation aggregation endpoint for Indiekit. Backend enrichment service that polls Mastodon/Bluesky notifications and serves JF2-compatible data for the interactions page.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -39,7 +39,8 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@indiekit/error": "^1.0.0-beta.25",
42
- "@indiekit/frontend": "^1.0.0-beta.25"
42
+ "@indiekit/frontend": "^1.0.0-beta.25",
43
+ "@rmdes/indiekit-startup-gate": "^1.0.0"
43
44
  },
44
45
  "publishConfig": {
45
46
  "access": "public"