@rmdes/indiekit-endpoint-lastfm 1.0.12 → 1.0.13

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 +9 -1
  2. package/package.json +2 -1
package/index.js CHANGED
@@ -8,6 +8,7 @@ import { lovedController } from "./lib/controllers/loved.js";
8
8
  import { statsController } from "./lib/controllers/stats.js";
9
9
  import { nowPlayingController } from "./lib/controllers/now-playing.js";
10
10
  import { startSync } from "./lib/sync.js";
11
+ import { waitForReady } from "@rmdes/indiekit-startup-gate";
11
12
 
12
13
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
13
14
 
@@ -108,7 +109,14 @@ export default class LastFmEndpoint {
108
109
 
109
110
  // Start background sync if database is available
110
111
  if (Indiekit.config.application.mongodbUrl) {
111
- startSync(Indiekit, this.options);
112
+ this._stopGate = waitForReady(
113
+ () => startSync(Indiekit, this.options),
114
+ { label: "Last.fm" },
115
+ );
112
116
  }
113
117
  }
118
+
119
+ destroy() {
120
+ this._stopGate?.();
121
+ }
114
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-lastfm",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Last.fm scrobble and listening activity endpoint for Indiekit. Display listening history, loved tracks, and statistics.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -43,6 +43,7 @@
43
43
  "index.js"
44
44
  ],
45
45
  "dependencies": {
46
+ "@rmdes/indiekit-startup-gate": "^1.0.0",
46
47
  "@indiekit/error": "^1.0.0-beta.25",
47
48
  "express": "^5.0.0"
48
49
  },