Skip to content

Commit a1d8791

Browse files
committed
update example
1 parent dbf1c4e commit a1d8791

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

example/convex/example.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ export const exampleWorkflow = workflow.define({
4141
const celsius = weather.temperature;
4242
const farenheit = (celsius * 9) / 5 + 32;
4343
const { temperature, windSpeed, windGust } = weather;
44+
// Show celsius 50% of the time
45+
const temp =
46+
Math.random() > 0.5 ? `${farenheit.toFixed(1)}°F` : `${temperature}°C`;
4447
console.log(
45-
`Weather in ${name}: ${farenheit.toFixed(1)}°F (${temperature}°C), ${windSpeed} km/h, ${windGust} km/h`,
48+
`Weather in ${name}: ${temp}, ${windSpeed} km/h, ${windGust} km/h`,
4649
);
4750
console.timeLog("weather", temperature);
4851
await step.runMutation(internal.example.updateFlow, {
@@ -191,7 +194,8 @@ export const updateFlow = internalMutation({
191194
.withIndex("workflowId", (q) => q.eq("workflowId", args.workflowId))
192195
.first();
193196
if (!flow) {
194-
throw new Error(`Flow not found: ${args.workflowId}`);
197+
console.warn(`Flow not found: ${args.workflowId}`);
198+
return;
195199
}
196200
await ctx.db.patch(flow._id, {
197201
out: args.out,

0 commit comments

Comments
 (0)