Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrImmediateReschedule = errors.New("commit tx, and reschedule ASAP") ErrDoNotReschedule = errors.New("no need to reschedule, we are done") )
Functions ¶
func MustPGXConfigFromCloudFoundry ¶
func MustPGXConfigFromCloudFoundry() *pgx.ConnConfig
Return a database object, using the CloudFoundry environment data
func PGXConfigFromCloudFoundry ¶
func PGXConfigFromCloudFoundry() (*pgx.ConnConfig, error)
Return a database object, using the CloudFoundry environment data
Types ¶
type Handler ¶
type Handler struct { PGXConnConfig *pgx.ConnConfig InitSQL string WorkerCount int WorkerMap map[string]*JobConfig OnStart func(qc *que.Client, pgxPool *pgx.ConnPool, logger *log.Logger) error Logger *log.Logger QueueName string }
func (*Handler) WorkForever ¶
type JobConfig ¶
type JobConfig struct { F JobFunc // Debug logging VerboseLogging bool // One will only be called at once Singleton bool // Will be rescheduled upon success Duration time.Duration // contains filtered or unexported fields }
type JobFunc ¶
JobFunc should do a thing. Return either: nil => wrapper will schedule the next cron (if a cron), then commit the tx. ErrImmediateReschedule => wrapper will commit the tx, then try it again immediately. ErrDidNotReschedule => wrapper will rollback the tx, and if a cron, will not reschedule or retry. any other error => wrapper rollback the tx, and allow que to reschedule
Click to show internal directories.
Click to hide internal directories.