@isomorph.ai/app-sdk 1.4.2 → 1.4.3
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/runtime.d.ts +3 -1
- package/dist/runtime.js +8 -3
- package/package.json +1 -1
package/dist/runtime.d.ts
CHANGED
|
@@ -72,6 +72,8 @@ export interface RuntimeOptions {
|
|
|
72
72
|
gatewayUrl: string;
|
|
73
73
|
mode: RuntimeMode;
|
|
74
74
|
tokenFile?: string;
|
|
75
|
+
/** False when the app has no runs table (ISOMORPH_JOB_RUNS=none): nothing reads or works it. */
|
|
76
|
+
jobRuns?: boolean;
|
|
75
77
|
log?: (line: string) => void;
|
|
76
78
|
/** The pause between queue passes while work is found; the tests shorten it. */
|
|
77
79
|
queuePollMs?: number;
|
|
@@ -89,7 +91,7 @@ export declare class Runtime {
|
|
|
89
91
|
readonly server: import("http").Server<typeof IncomingMessage, typeof ServerResponse>;
|
|
90
92
|
constructor(options: RuntimeOptions);
|
|
91
93
|
start(): Promise<number>;
|
|
92
|
-
/** Whether this process works the queue at all: not the gate, an app with jobs, a gateway to reach. */
|
|
94
|
+
/** Whether this process works the queue at all: not the gate, a runs table, an app with jobs, a gateway to reach. */
|
|
93
95
|
private worksQueue;
|
|
94
96
|
/**
|
|
95
97
|
* Starts the queue loop unless it is already live. The first pass runs at
|
package/dist/runtime.js
CHANGED
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
// in-process scheduler. Set by Provision on the
|
|
45
45
|
// hosted kit-runtime; `isomorph dev` leaves it
|
|
46
46
|
// unset and keeps cron in-process
|
|
47
|
+
// ISOMORPH_JOB_RUNS=none the app has no runs table (it never calls
|
|
48
|
+
// isomorph.jobs): no queue loop, and --run-job
|
|
49
|
+
// runs without waiting on the data path. Set by
|
|
50
|
+
// Provision; the table exists otherwise
|
|
47
51
|
// ISOMORPH_APP_ROOT the app root (default: the working directory)
|
|
48
52
|
import { createServer } from 'node:http';
|
|
49
53
|
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
@@ -256,9 +260,9 @@ export class Runtime {
|
|
|
256
260
|
this.wakeQueue();
|
|
257
261
|
return port;
|
|
258
262
|
}
|
|
259
|
-
/** Whether this process works the queue at all: not the gate, an app with jobs, a gateway to reach. */
|
|
263
|
+
/** Whether this process works the queue at all: not the gate, a runs table, an app with jobs, a gateway to reach. */
|
|
260
264
|
worksQueue() {
|
|
261
|
-
return this.options.mode !== 'gate' && this.inventory.jobs.length > 0 && Boolean(this.options.gatewayUrl);
|
|
265
|
+
return this.options.mode !== 'gate' && this.options.jobRuns !== false && this.inventory.jobs.length > 0 && Boolean(this.options.gatewayUrl);
|
|
262
266
|
}
|
|
263
267
|
/**
|
|
264
268
|
* Starts the queue loop unless it is already live. The first pass runs at
|
|
@@ -313,7 +317,7 @@ export class Runtime {
|
|
|
313
317
|
this.log(`this app has no ${JOBS_DIR}/${name}.ts`);
|
|
314
318
|
return false;
|
|
315
319
|
}
|
|
316
|
-
if (this.options.gatewayUrl && !(await this.awaitDataPath()))
|
|
320
|
+
if (this.options.gatewayUrl && this.options.jobRuns !== false && !(await this.awaitDataPath()))
|
|
317
321
|
return false;
|
|
318
322
|
return this.runScheduled(name, new Date(Math.floor(now.getTime() / 60_000) * 60_000));
|
|
319
323
|
}
|
|
@@ -529,6 +533,7 @@ export function optionsFromEnvironment(env = process.env) {
|
|
|
529
533
|
gatewayUrl: (env.ISOMORPH_GATEWAY_URL || env.HARBOUR_GATEWAY_URL || '').replace(/\/$/, ''),
|
|
530
534
|
mode: env.ISOMORPH_RUNTIME_MODE === 'gate' ? 'gate' : env.ISOMORPH_JOBS_SCHEDULER === 'platform' ? 'actions' : 'full',
|
|
531
535
|
tokenFile: env.HARBOUR_WORKLOAD_TOKEN_FILE || undefined,
|
|
536
|
+
jobRuns: env.ISOMORPH_JOB_RUNS !== 'none',
|
|
532
537
|
};
|
|
533
538
|
}
|
|
534
539
|
/** The job named by `--run-job <name>` or `--run-job=<name>`; undefined when the runtime is a server. */
|