jobtrack 1.1.0 → 1.2.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jobtrack",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Runs the JobTrack API + web UI as one background process with a Windows tray icon",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@fastify/static": "^10.1.3",
|
|
33
|
-
"@jobtrack/api": "^1.0
|
|
33
|
+
"@jobtrack/api": "^1.2.0",
|
|
34
34
|
"fastify": "^5.12.1",
|
|
35
35
|
"systray": "^1.0.5",
|
|
36
36
|
"tsx": "^4.23.12"
|
package/src/cli.ts
CHANGED
|
@@ -36,7 +36,7 @@ if (home) process.env.JOBTRACK_HOME = resolve(home);
|
|
|
36
36
|
|
|
37
37
|
const noTray = argv.includes('--no-tray') || process.env.JOBTRACK_NO_TRAY === '1';
|
|
38
38
|
|
|
39
|
-
const { app, config, repos, search } = await startServer();
|
|
39
|
+
const { app, config, repos, search, jobs } = await startServer();
|
|
40
40
|
|
|
41
41
|
const url = `http://${config.host === '0.0.0.0' ? '127.0.0.1' : config.host}:${config.port}`;
|
|
42
42
|
console.log(`JobTrack v${APP_VERSION} running at ${url} (driver: ${config.driver})`);
|
|
@@ -57,6 +57,7 @@ let shuttingDown = false;
|
|
|
57
57
|
async function shutdown(): Promise<void> {
|
|
58
58
|
if (shuttingDown) return;
|
|
59
59
|
shuttingDown = true;
|
|
60
|
+
jobs.stop();
|
|
60
61
|
search.stop();
|
|
61
62
|
await app.close();
|
|
62
63
|
await repos.close();
|
package/src/server.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { RepoBundle } from '@jobtrack/api/db/repos';
|
|
|
14
14
|
import { SearchIndex } from '@jobtrack/api/search';
|
|
15
15
|
import { DisabledEmbedder, type Embedder } from '@jobtrack/api/search/embedder';
|
|
16
16
|
import { TransformersEmbedder } from '@jobtrack/api/search/transformers-embedder';
|
|
17
|
+
import { startBackgroundJobs, type BackgroundJobs } from '@jobtrack/api/jobs/scheduler';
|
|
17
18
|
import { resolveWebDist } from './assets.js';
|
|
18
19
|
import { APP_PACKAGE } from './version.js';
|
|
19
20
|
|
|
@@ -28,6 +29,7 @@ export interface RunningServer {
|
|
|
28
29
|
config: Config;
|
|
29
30
|
repos: RepoBundle;
|
|
30
31
|
search: SearchIndex;
|
|
32
|
+
jobs: BackgroundJobs;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export async function startServer(): Promise<RunningServer> {
|
|
@@ -94,5 +96,11 @@ export async function startServer(): Promise<RunningServer> {
|
|
|
94
96
|
process.exit(EXIT_PORT_IN_USE);
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
// Only once listening: a second JobTrack that lost the port race exits above, and must not
|
|
100
|
+
// have started running rules against the shared database first.
|
|
101
|
+
const jobs = startBackgroundJobs({ repos, search, config }, {
|
|
102
|
+
log: (message, error) => console.warn(`[jobs] ${message}`, error ?? ''),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return { app, config, repos, search, jobs };
|
|
98
106
|
}
|