Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: onschedule error #402

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/lib/assets/pods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ export const namespace: kind.Namespace = {
export function watcher(assets: Assets, hash: string) {
const { name, image, capabilities, config } = assets;

let hasSchedule = false;

// Append the watcher suffix
const app = `${name}-watcher`;
const bindings: Binding[] = [];

// Loop through the capabilities and find any Watch Actions
for (const capability of capabilities) {
if (capability.hasSchedule) {
hasSchedule = true;
}
const watchers = capability.bindings.filter(binding => binding.isWatch);
bindings.push(...watchers);
}

// If there are no watchers, don't deploy the watcher
if (bindings.length < 1) {
if (bindings.length < 1 && !hasSchedule) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/capability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export class Capability implements CapabilityExport {
*/
OnSchedule: (schedule: Schedule) => void = (schedule: Schedule) => {
const { name, every, unit, run, startTime, completions } = schedule;
this.hasSchedule = true;

if (process.env.PEPR_WATCH_MODE === "true") {
// Only create/watch schedule store if necessary
this.hasSchedule = true;

// Create a new schedule
const newSchedule: Schedule = {
Expand Down