Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit 25661bb

Browse files
committed
Refactor configuration and improve issue handling
- Removed the `wrangler.toml` file as part of the project restructuring. - Updated `wrangler.jsonc` to eliminate the 5-minute cron job, simplifying the scheduling. - Modified the `listRepositoryIssues` function in `handlers.ts` to return an empty JSON array instead of a not found response when no issues are present. - Streamlined the queue handling logic in `index.ts` by removing unnecessary checks for the queue name. These changes enhance the clarity and efficiency of the codebase while maintaining functionality.
1 parent 3463bdf commit 25661bb

4 files changed

Lines changed: 3 additions & 37 deletions

File tree

src/handlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const listRepositoryIssues = async (c: Context<{ Bindings: Env }>) => {
2323
const issues = await cacheService.getIssuesForRepository(plugin);
2424

2525
if (!issues || issues.length === 0) {
26-
return c.notFound();
26+
return c.json([]);
2727
}
2828

2929
return c.json(issues);

src/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ export default {
5151

5252
// Queue handler - must be declared as a function, not an object
5353
async queue(batch: MessageBatch<GitHubTaskMessage>, env: Env, ctx: ExecutionContext) {
54-
// Get the queue name from the batch
55-
if (batch.queue === 'github-tasks') {
56-
await processGitHubTasks(batch, env);
57-
}
54+
await processGitHubTasks(batch, env);
5855
},
5956

6057
// Handle scheduled events
@@ -73,9 +70,6 @@ export default {
7370
// Hourly jobs
7471
await refreshGithubStats(context);
7572
await refreshPackagistStats(context);
76-
} else if (controller.cron === '*/5 * * * *') {
77-
console.log('Starting Repository Issues 5-minute job');
78-
// Every 5 minutes
7973
await refreshRepositoryIssues(context);
8074
}
8175
}

wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@
3636
},
3737

3838
"triggers": {
39-
"crons": ["0 * * * *", "*/5 * * * *"]
39+
"crons": ["0 * * * *"]
4040
}
4141
}

wrangler.toml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)