GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(server): scheduled tasks can run on a webhook by juliusmarminge · Pull Request #15085 · pingdotgg/t3code

feat(server): scheduled tasks can run on a webhook #15085

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.

Sign up for GitHub

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

Merged
juliusmarminge merged 14 commits into main from t3code/webhooks-server
Oct 5, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

feat(server): scheduled tasks can run on a webhook #15085

Changes from 1 commit
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
699ab02
feat(server): scheduled tasks can run on a webhook
juliusmarminge Oct 3, 2026
7f0a7a2
chore(server): keep webhook helpers module-private
juliusmarminge Oct 3, 2026
ce3c5a7
fix(web,mobile): label webhook tasks until their editors land
juliusmarminge Oct 3, 2026
fdfc501
fix(server): harden the webhook route against floods and races
juliusmarminge Oct 3, 2026
3dd09ab
test(server): drop an unused type directive
juliusmarminge Oct 3, 2026
595eb9e
fix(server): delivery log keeps the newest requests on timestamp ties
juliusmarminge Oct 3, 2026
f9cb655
fix(server): webhook delivery log stays private and bounded
juliusmarminge Oct 3, 2026
75e516b
fix(web): webhook tasks hide run-now and explain unopened deep links
juliusmarminge Oct 3, 2026
2c3ab46
fix(server): webhook saves and dispatch hold up under concurrency
juliusmarminge Oct 3, 2026
90fedc7
fix(web): thread automations panel disables run-now for webhook tasks
juliusmarminge Oct 3, 2026
c230d88
fix(server): rotation and the delivery cap respect recreated tasks
juliusmarminge Oct 3, 2026
d63ef44
fix(server): queue counts are per task generation
juliusmarminge Oct 3, 2026
c8cf017
refactor(server): the webhook route is part of the environment HttpApi
juliusmarminge Oct 3, 2026
08df570
fix(server): queued webhook deliveries skip tasks switched off the we…
juliusmarminge Oct 5, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
fix(server): queue counts are per task generation
A delivery of a deleted task that finished after the task was recreated
under the same id decremented the new task's count. Key the count by id
and creation time instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge
juliusmarminge committed Oct 5, 2026
commit d63ef44a1ffa175ef6b61b56d694ccefeba375e3

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

23 changes: 11 additions & 12 deletions 23 apps/server/src/scheduledTasks/ScheduledTaskService.ts
Show comments
View file
Open in desktop
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,9 @@ export const layer = Layer.effect(
const webhookPermits = yield* Ref.make<ReadonlyMap<ScheduledTaskId, Semaphore.Semaphore>>(
new Map(),
);
const webhookQueued = yield* Ref.make<ReadonlyMap<ScheduledTaskId, number>>(new Map());
// Keyed by task id and creation time, so deliveries of a deleted task that
// finish late release their own count, never a recreated task's.
const webhookQueued = yield* Ref.make<ReadonlyMap<string, number>>(new Map());
const webhookRateWindows = yield* Ref.make<ReadonlyMap<ScheduledTaskId, RateWindow>>(new Map());
const activeRuns = yield* Ref.make<ReadonlySet<ScheduledTaskId>>(new Set());
// Sliding(1) coalesces the dirty-signal: every notification triggers a
Expand Down Expand Up @@ -1062,12 +1064,6 @@ export const layer = Layer.effect(
next.delete(input.id);
return next;
}),
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

// Old deliveries still finishing must not fill a recreated task's queue.
Ref.update(webhookQueued, (queued) => {
const next = new Map(queued);
next.delete(input.id);
return next;
}),
]),
),
Effect.andThen(notifyChanged),
Expand Down Expand Up @@ -1357,18 +1353,21 @@ export const layer = Layer.effect(
// Bound the deliveries one task holds, so steady traffic to a stuck
// task cannot pile up parked fibers. A refused request is not logged,
// so it cannot push real deliveries out of the log.
const queueKey = `${task.id}\u0000${task.createdAt}`;
const queued = yield* Ref.modify(webhookQueued, (counts) => {
const count = counts.get(task.id) ?? 0;
const count = counts.get(queueKey) ?? 0;
return count >= WEBHOOK_MAX_QUEUED_PER_TASK
? ([false, counts] as const)
: ([true, new Map(counts).set(task.id, count + 1)] as const);
: ([true, new Map(counts).set(queueKey, count + 1)] as const);
});
if (!queued) return { _tag: "rate_limited" as const };
// Entries leave the map when their count reaches zero, so a deleted
// task's key does not linger once its last delivery finishes.
const release = Ref.update(webhookQueued, (counts) => {
const next = new Map(counts);
const count = (next.get(task.id) ?? 1) - 1;
if (count <= 0) next.delete(task.id);
else next.set(task.id, count);
const count = (next.get(queueKey) ?? 1) - 1;
if (count <= 0) next.delete(queueKey);
else next.set(queueKey, count);
return next;
});
yield* log("accepted", {
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.