Documentation ¶
Index ¶
Constants ¶
const ( DefaultRetryAttempts = 0 DefaultRestartOnError = false )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // When set to true the server will attempt to restart failed jobs RestartOnError bool // The number of times a job will be retried before it is deleted // when an error occurs // // Default: 0 RetryAttempts int // This is the periodic time in which the server can execute // background tasks background tasks can run infinitely // as long as the server is running // for example you can use this to make requests to other servers // or update your database // // Default: 5 minutes BackgroundTimeout time.Duration }
type Cron ¶
type Cron struct {
// contains filtered or unexported fields
}
func (*Cron) Start ¶
func (c *Cron) Start()
Call this method to start the cron
By default cron jobs are executed in their own goroutines hence in separate threads This method starts the cron jobs in a new thread away from the server's main thread
This ensures non blocking execution of cron jobs hence the server can handle requests as cron jobs are executed with minimal impact on the server
type Job ¶
This is the structure of a background job you can use this to put whatever jobs you want to perform in the background as the server runs and Pine will take care of executing them in the background
time is optional and defaults to 5 minutes according to the server configuration
Fn is the function that will be executed. It should always return an error. If error is not nil the error will be used to delete the task from the queue otherwise when nil the task will run indefinitely