Skip to content

Comments

Create route for externally-managed triggers that run only once#128

Merged
tmccombs merged 1 commit intolucidsoftware:masterfrom
aegbert5:create-state-for-single-run-triggers
Feb 13, 2026
Merged

Create route for externally-managed triggers that run only once#128
tmccombs merged 1 commit intolucidsoftware:masterfrom
aegbert5:create-state-for-single-run-triggers

Conversation

@aegbert5
Copy link
Contributor

@aegbert5 aegbert5 commented Dec 30, 2025

This creates the /triggers/:group/:name/onetime/:id route to allow for one-time triggers to be created that don't run on a cron schedule. One-time triggers a different from simple triggers, because they require an ID provided to the route, allowing them to be managed outside of piezo

@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch 2 times, most recently from b44be52 to 78d57ed Compare January 13, 2026 21:35
@aegbert5 aegbert5 requested a review from tmccombs January 13, 2026 21:38
@aegbert5 aegbert5 marked this pull request as ready for review January 13, 2026 21:38
@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch 6 times, most recently from a7c8451 to 3aba153 Compare January 13, 2026 21:53
@hunterrees hunterrees self-requested a review January 13, 2026 22:46
@aegbert5 aegbert5 requested a review from hunterrees January 15, 2026 22:38
Copy link

@hunterrees hunterrees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not ready to approve yet, but if we keep this approach I don't think we'll need changes. I'd like to discuss the option I outlined of not creating a new table before we proceed.

@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch 6 times, most recently from 3df4be0 to 8449c7c Compare January 22, 2026 16:41
@aegbert5 aegbert5 requested a review from hunterrees January 22, 2026 16:44
@tmccombs
Copy link
Contributor

You should probably update the description, since it doesn't involve creating a database anymore.

@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch from 8449c7c to 20b65a3 Compare January 22, 2026 23:09
@aegbert5 aegbert5 changed the title Create database for single run triggers Create route for externally-managed triggers that run only once Jan 22, 2026
@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch 3 times, most recently from 6fbbb6e to de07e18 Compare January 29, 2026 20:44
@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch 2 times, most recently from 4d096b9 to 85d8814 Compare January 29, 2026 21:25
@aegbert5 aegbert5 requested a review from tmccombs January 29, 2026 21:26
Copy link
Contributor

@tmccombs tmccombs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there.

But you need to actually check the value of your EXISTS query, and your test isn't actually testing that we don't insert a duplicate record.

@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch 7 times, most recently from 145235f to 6fe78d7 Compare February 4, 2026 21:22
@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch from 6fe78d7 to f6eee6b Compare February 4, 2026 23:58
@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch from f6eee6b to 381768b Compare February 5, 2026 00:02
private final val prefixForOneTimeJobs = "ONE_TIME_"
final def oneTimeFireInstanceId(id: Long): String = prefixForOneTimeJobs + id.toString()
private final val triggerKeyGroup = "ONE_TIME_JOB"
final def oneTimeTriggerKey(fireInstanceId: Long): TriggerKey = TriggerKey(fireInstanceId.toString, triggerKeyGroup)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to use the instance id for the trigger name? Would it be better to use the job name or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the UI, the trigger name and group will be displayed to indicate recent executions of the job. I think the instance id as a trigger name is a lot more intuitive than just presenting the name of the job you are running. This is what the UI looks like
image

@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch 2 times, most recently from eb219e7 to ea1115d Compare February 7, 2026 00:49

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to manually apply this patch everywhere unfortunately (we probably don't care as much about dev/staging though)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should flatten these patches, so that there is just a single sql file you run to set up the tables (but keep the patches files so you can migrate existing DBs?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think thats a good idea, but it is out of scope for this PR

@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch 2 times, most recently from 446705d to c5f711c Compare February 11, 2026 17:32
@aegbert5 aegbert5 force-pushed the create-state-for-single-run-triggers branch from c5f711c to b6b148f Compare February 11, 2026 17:38
@tmccombs tmccombs merged commit b99b585 into lucidsoftware:master Feb 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants