Rich
Rich
Explore posts from servers
EDSEthan's dev spot
Created by Rich on 10/25/2023 in #questions
Multiple Cron Jobs
export const jobs = (app: Elysia) => app
.use(cron({
name: 'job_1',
pattern: '*/10 * * * * *',
run() { console.log('job 1') }
}))
.use(cron({
name: 'job_2',
pattern: '*/10 * * * * *',
run() { console.log('job 2') }
}))
.post("/jobs/trigger", ({ store: { cron: { job_1, job_2} }}) => {
console.log("triggering jobs")
job_1.trigger()
job_2.trigger()
})
export const jobs = (app: Elysia) => app
.use(cron({
name: 'job_1',
pattern: '*/10 * * * * *',
run() { console.log('job 1') }
}))
.use(cron({
name: 'job_2',
pattern: '*/10 * * * * *',
run() { console.log('job 2') }
}))
.post("/jobs/trigger", ({ store: { cron: { job_1, job_2} }}) => {
console.log("triggering jobs")
job_1.trigger()
job_2.trigger()
})
Anyone here have experience with multiple cron jobs? This creates 2 jobs that both run, yet when I try to manually trigger them job_1.trigger() works and job_2.trigger() errors undefined is not an object (evaluating 'job_2.trigger')
5 replies
EDSEthan's dev spot
Created by Rich on 10/20/2023 in #questions
Form submission issue
Hey, trying to figure out some htmx/form problem.
<form
hx-post={`/tierlists/${tierlistId}/grades`}
hx-target-4xx="#errors"
hx-target-5xx="#errors"
hx-swap="beforeend"
>
<input value={"1"} hidden="true" name="cardNumber" />
<div>{LetterGrades.map((g) =>
<label for={`grade-${g}`}><input type="radio" id={`grade-${g}`} name="letterGrade" value={g} />{g}</label>
)}</div>
<button type="submit">Grade</button>
</form>
<div id="errors">errors go here</div>
<form
hx-post={`/tierlists/${tierlistId}/grades`}
hx-target-4xx="#errors"
hx-target-5xx="#errors"
hx-swap="beforeend"
>
<input value={"1"} hidden="true" name="cardNumber" />
<div>{LetterGrades.map((g) =>
<label for={`grade-${g}`}><input type="radio" id={`grade-${g}`} name="letterGrade" value={g} />{g}</label>
)}</div>
<button type="submit">Grade</button>
</form>
<div id="errors">errors go here</div>
When I submit the form, the page does a full refresh, the input values are appended to URL, and my POST request is not hit on my server. Anyone have ideas on how to resolve/troubleshoot? Curl works on expected route, the hx-post attribute in devtools looks correct
5 replies