Skip to content

Commit

Permalink
Fix build with optional cron
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Dec 5, 2024
1 parent 2d1bf36 commit 0939de3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion api/lib/events-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export default class EventsPool {

for (const layer of layers.values()) {
try {
this.add(layer.id, layer.cron);
if (layer.cron) {
this.add(layer.id, layer.cron);
}
} catch (err) {
console.error(`CloudTAK Cron: Init Error on Layer ${layer.id}`, err);
}
Expand Down
2 changes: 1 addition & 1 deletion api/lib/models/Layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const AugmentedLayer = Type.Object({
uuid: Type.String(),
name: Type.String(),
webhooks: Type.Boolean(),
cron: Type.Union([Type.String(), Type.Null()]),
description: Type.String(),
enabled: Type.Boolean(),
enabled_styles: Type.Boolean(),
Expand All @@ -28,7 +29,6 @@ export const AugmentedLayer = Type.Object({
stale: Type.Integer(),
task: Type.String(),
connection: Type.Optional(Type.Integer()),
cron: Type.String(),
environment: Type.Any(),
ephemeral: Type.Record(Type.String(), Type.String()),
config: Layer_Config,
Expand Down
3 changes: 2 additions & 1 deletion api/lib/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ export const LayerTemplate = pgTable('layers_template', {
logging: boolean().notNull().default(true),
stale: integer().notNull().default(20),
task: text().notNull(),
cron: text().notNull(),
cron: text(),
webhooks: boolean().notNull().default(false),
config: json().$type<Static<typeof Layer_Config>>().notNull().default({}),
memory: integer().notNull().default(128),
timeout: integer().notNull().default(128),
Expand Down

0 comments on commit 0939de3

Please sign in to comment.