feat(websub): wire real-time push notifications on email ingest
Pass ExecutionContext through the email processing chain so notifySubscribers is called via ctx.waitUntil after a new email is stored. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
6d221a07dd
commit
d0764ddd8e
4 files changed
+10
-2
No files matched your search
@@ -6,6 +6,7 @@ import {
|
||||
FeedConfig,
|
||||
FeedMetadata,
|
||||
} from "../types";
|
||||
import { notifySubscribers } from "../utils/websub";
|
||||
|
||||
export interface RawAttachment {
|
||||
filename: string;
|
||||
@@ -73,6 +74,7 @@ async function uploadAttachments(
|
||||
export async function processEmail(
|
||||
input: ProcessEmailInput,
|
||||
env: Env,
|
||||
ctx?: ExecutionContext,
|
||||
): Promise<Response> {
|
||||
const feedId = EmailParser.extractFeedId(input.toAddress);
|
||||
if (!feedId) {
|
||||
@@ -182,5 +184,8 @@ export async function processEmail(
|
||||
]);
|
||||
|
||||
console.log(`Successfully processed email for feed ${feedId}`);
|
||||
if (ctx) {
|
||||
ctx.waitUntil(notifySubscribers(feedId, env));
|
||||
}
|
||||
return new Response("Email processed successfully", { status: 200 });
|
||||
}
|
||||
Reference in new issue
Block a user