Skip to content

Commit

Permalink
Return seed callback to enable awaiting result
Browse files Browse the repository at this point in the history
ensures that the seed command can complete all of its async work and exit properly and makes it so that errors can be caught and logged (lines 45–47)
  • Loading branch information
acusti committed Jan 28, 2025
1 parent eda1ad7 commit 37d05e5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion packages/superflare/cli/db/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export async function seedDb(dbName: string, seedPath: string) {
if (!d1Database) {
throw new Error(`Database ${dbName} not found`);
}
// TODO: Find out why errors in the seeder are not bubbled to this try/catch
if (seedModule.default) {
await seedModule.default(d1Database);
logger.info(`Seeding complete!`);
Expand Down
2 changes: 1 addition & 1 deletion packages/superflare/src/seeder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { setConfig } from "./config";
export function seed(callback: () => void) {
return (database: D1Database) => {
setConfig({ database: { default: database } });
callback();
return callback();
};
}

0 comments on commit 37d05e5

Please sign in to comment.