Guides
Scheduled execution
Firechain's async design allows for the scheduling of messages to be processed at a later time. Messages can be scheduled to be processed at a specific time or after a specific amount of time has passed. This is useful for applications that need to schedule operations to be executed at a later time, such as scheduled payouts, or internal automation and maintenance tasks.
Scheduling
Firechain's scheduling system provides a flexible way to plan executions in the future. You can schedule a message to be processed at a specific time or after a specific amount of time has passed. You can also schedule recurring tasks to run at a specific interval.
Scheduling a message
Pyro provides an intuitive interface for scheduling messages for a certain point in time. You can use the @context.schedule
method to schedule a message to be processed at a specific time or after a specific amount of time has passed. The @context.schedule
method takes the message to be processed, and the time at which the message should be processed.
entity MyEntity {
@public
function proxySchedule(to: address, data: bytes, delay: uint): uint {
@context.schedule(
message: Message(
to: to,
data: data
),
time: @context.time + 60 seconds
)
}
}
Currently, only entities can initiate scheduled executions as there's no RPC method for scheduling messages. However, we're working on adding support for scheduling messages via RPC and the Firechain CLI. In the meantime, the only way for a user to access this functionality is to create a entity that schedules messages on their behalf.