Time-based job runner for Gingee apps (declarative schedules in `app.json`).
Server gate: `gingee.json` → `scheduler.enabled` (default
false).
Multi-node: set scheduler.coordination.driver: "redis" and configure
sibling scheduler.redis (same shape as queue.redis / cache.redis) so only one
node runs each occurrence (tick locks) or only the elected leader runs jobs
(strategy leader). Without coordination, enable the scheduler on at most one
node for script/url targets (or use queue targets with redis queue).
App config: `app.json` → `schedules` array. Each job needs a unique `name`, a
`cron` expression, and a `target` of type script, url, or
queue.
Permissions: App must be granted scheduler to register any jobs
and to require('scheduler'). URL targets also require httpclient;
queue targets also require queue.
App API: module:scheduler.rebind — refresh this app's CRON registrations
from disk app.json without a full platform.reloadApp.
Defaults: overlap = skip, misfire = skip, timezone from job or server default (UTC).- Description:
- Time-based job runner for Gingee apps (declarative schedules in `app.json`).
Server gate: `gingee.json` → `scheduler.enabled` (default
false). Multi-node: setscheduler.coordination.driver: "redis"and configure siblingscheduler.redis(same shape as queue.redis / cache.redis) so only one node runs each occurrence (tick locks) or only the elected leader runs jobs (strategyleader). Without coordination, enable the scheduler on at most one node for script/url targets (or use queue targets with redis queue). App config: `app.json` → `schedules` array. Each job needs a unique `name`, a `cron` expression, and a `target` of typescript,url, orqueue. Permissions: App must be grantedschedulerto register any jobs and torequire('scheduler'). URL targets also requirehttpclient; queue targets also requirequeue. App API:module:scheduler.rebind— refresh this app's CRON registrations from diskapp.jsonwithout a fullplatform.reloadApp. Defaults: overlap = skip, misfire = skip, timezone from job or server default (UTC).
- Time-based job runner for Gingee apps (declarative schedules in `app.json`).
Server gate: `gingee.json` → `scheduler.enabled` (default
Members
(inner, constant) appJobs :Map.<string, Map.<string, object>>
- Description:
- appName → Map(jobName → jobRuntime)
appName → Map(jobName → jobRuntime)
Type:
- Map.<string, Map.<string, object>>
(inner) coordinator :object|null
Type:
- object | null
(inner) globalConfigRef :object|null
Type:
- object | null
(inner) serverConfig :Object
Type:
- Object
(inner) serverLogger :object|null
Type:
- object | null
Methods
(static) rebind(scheduleNamesopt) → {Promise.<{rebound: Array.<string>}>}
- Description:
- Refresh CRON registrations for the **calling app** from disk
app.json→schedules. Does not reinit db/email or enter maintenance. OmitscheduleNamesor pass[]to rebind all jobs; otherwise only the named jobs (unknown names throw). No-op for registration when serverscheduler.enabledis false (same asmodule:scheduler.registerApp), but still refreshesapp.config.schedulesfrom disk.
- Refresh CRON registrations for the **calling app** from disk
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
scheduleNames |
Array.<string> |
<optional> |
Job names to rebind; empty/omit = all. |
Returns:
- Type
- Promise.<{rebound: Array.<string>}>
(inner) getAdminStatus() → {object}
- Description:
- Admin/status snapshot for Glade.
Returns:
- Type
- object
(inner) initServer(config, logger, globalConfig)
- Description:
- Initialize server-level scheduler settings.
Parameters:
| Name | Type | Description |
|---|---|---|
config |
object | null | undefined | from gingee.json → scheduler |
logger |
object | |
globalConfig |
object | full server config (for box/privileged apps) |
(inner) listJobs(optsopt) → {Array.<object>}
- Description:
- List registered jobs (tests / Glade admin UI).
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object |
<optional> |
Properties
|
Returns:
- Type
- Array.<object>
(async, inner) registerApp(app)
- Description:
- Register schedules for one app from app.config.schedules. No-op if server scheduler is disabled or app has no schedules.
Parameters:
| Name | Type | Description |
|---|---|---|
app |
object |
(async, inner) reinitApp(appName, app)
- Description:
- Re-read app schedules after reload.
Parameters:
| Name | Type | Description |
|---|---|---|
appName |
string | |
app |
object |
(async, inner) runNow(appName, jobName) → {Promise.<object>}
- Description:
- Force-run a registered job (tests / Glade "Run now"). Bypasses multi-node coordination so an operator can always trigger a run.
Parameters:
| Name | Type | Description |
|---|---|---|
appName |
string | |
jobName |
string |
Returns:
result status snapshot
- Type
- Promise.<object>
(inner) shutdown()
- Description:
- Stop all scheduled jobs (server shutdown).
(inner) unregisterApp(appName)
- Description:
- Stop and remove all jobs for an app.
Parameters:
| Name | Type | Description |
|---|---|---|
appName |
string |