Reducer that schedules the scheduled_proc procedure
| 224 | |
| 225 | // Reducer that schedules the scheduled_proc procedure |
| 226 | SPACETIMEDB_REDUCER(schedule_proc, ReducerContext ctx) { |
| 227 | LOG_INFO("schedule_proc called at timestamp: " + std::to_string(ctx.timestamp.micros_since_epoch())); |
| 228 | // Schedule the procedure to run in 1s (1000ms = 1,000,000 microseconds) |
| 229 | ctx.db[scheduled_proc_table].insert(ScheduledProcTable{ |
| 230 | 0, // scheduled_id (auto-incremented) |
| 231 | ScheduleAt(TimeDuration::from_micros(1000000)), // 1 second from now |
| 232 | ctx.timestamp, // Store the timestamp at which this reducer was called |
| 233 | 42, // x |
| 234 | 24 // y |
| 235 | }); |
| 236 | |
| 237 | return Ok(); |
| 238 | } |
| 239 | |
| 240 | // Procedure that should be called 1s after schedule_proc |
| 241 | SPACETIMEDB_PROCEDURE(Unit, scheduled_proc, ProcedureContext ctx, ScheduledProcTable data) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…