You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There will be times where you have tasks that need to be executed on a fixed schedule like checking peer health or aggregating data and storing it. Setting up crontab or keeping track of intervals and timeouts can be a pain.
Core makes running recurring tasks easy by providing a task scheduling manager that allows tasks to be scheduled based on times or block events.
Prerequisites
Before we start, we need to establish what a few recurring variables and imports in this document refer to when they are used.
The app import refers to the application instance which grants access to the container, configurations, system information and more.
The Container import refers to a namespace that contains all of the container-specific entities like binding symbols and interfaces.
The Services import refers to a namespace that contains all of the core services. This generally will only be needed for type hints as Core is responsible for service creation and maintenance.
Currently, we only have one recurring task which is that we ping some peers every X minutes. It works based on a variable named nextUpdateNetworkStatusScheduled inside the NetworkMonitor class and is based on a fixed schedule so it would be an obvious candidate for the task scheduling.
The text was updated successfully, but these errors were encountered:
There will be times where you have tasks that need to be executed on a fixed schedule like checking peer health or aggregating data and storing it. Setting up crontab or keeping track of intervals and timeouts can be a pain.
Core makes running recurring tasks easy by providing a task scheduling manager that allows tasks to be scheduled based on times or block events.
Prerequisites
Before we start, we need to establish what a few recurring variables and imports in this document refer to when they are used.
app
import refers to the application instance which grants access to the container, configurations, system information and more.Container
import refers to a namespace that contains all of the container-specific entities like binding symbols and interfaces.Services
import refers to a namespace that contains all of the core services. This generally will only be needed for type hints as Core is responsible for service creation and maintenance.Cron Job
Get an instance of a CronJob
Schedule the job to run every minute
Schedule the job to run every five minutes
Schedule the job to run every ten minutes
Schedule the job to run every fifteen minutes
Schedule the job to run every thirty minutes
Schedule the job to run hourly
Schedule the job to run hourly at a given offset in the hour
Schedule the job to run daily
Schedule the job to run daily at a given time (10:00, 19:30, etc)
Schedule the job to run only on weekdays
Schedule the job to run only on weekends
Schedule the job to run only on Mondays
Schedule the job to run only on Tuesdays
Schedule the job to run only on Wednesdays
Schedule the job to run only on Thursdays
Schedule the job to run only on Fridays
Schedule the job to run only on Saturdays
Schedule the job to run only on Sundays
Schedule the job to run weekly
Schedule the job to run weekly on a given day and time
Schedule the job to run monthly
Schedule the job to run monthly on a given day and time
Schedule the job to run quarterly
Schedule the job to run yearly
Block Job
Get an instance of a BlockJob
Schedule the job to run every block.
Schedule the job to run every five blocks.
Schedule the job to run every ten blocks.
Schedule the job to run every fifteen blocks.
Schedule the job to run every thirty blocks.
Schedule the job to run every round.
Integration
Currently, we only have one recurring task which is that we ping some peers every X minutes. It works based on a variable named
nextUpdateNetworkStatusScheduled
inside theNetworkMonitor
class and is based on a fixed schedule so it would be an obvious candidate for the task scheduling.The text was updated successfully, but these errors were encountered: