schedule

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 14 Imported by: 0

README

schedule

The schedule module represents the legwork implementation done behind the scenes for events. This communicates to worker threads over tcp using zeromq to split work evenly and rapidly. This in a way represents a self-made attempt at a Messaging Queue (currently without priority or logging).

Documentation

Overview

The schedule package takes care of any "scheduled tasks". Using a combination of Cron and ZeroMQ, the schedule package distributes the consumption of tasks to multiple workers in order to speed up work as much as possible.

Index

Constants

Time that a Worker should sleep/wait in the event of no tasks being ready

View Source
const EventHealthTaskCapacity uint8 = 50

Number of Event Health Tasks to pop off of redis Maybe this should be in schedule.go

View Source
const HealthTaskPrefix string = "healthTask"

Game Health Checking to garbage collect game data

View Source
const MagicRune rune = '~'

Labeled MagicRune as a joke for Golangs named type Used as seperator for communicating work to workers Task Name/Prefix + MagicRune + Params/Data

View Source
const NumberOfTaskWorkers uint8 = 10

Number of Workers to Distribute to with ZeroMQ

View Source
const ProxyBEPort string = ":5566"

Proxy Sub Port for receiving From (workers)

View Source
const ProxyControlPort string = ":5567"

Proxy Control Port for Interrupting Proxy

View Source
const ProxyFEPort string = ":5565"

Proxy Publish Port for sending to (application)

View Source
const RecvIOTimeoutDuration time.Duration = time.Duration(time.Microsecond)

Time that a worker should spend waiting to receive for new work

View Source
const TestTaskPrefix string = "unitTest0"

Unit Testing Prefix for adding to the database using workers

Variables

This section is empty.

Functions

func SendTasksToWorkers added in v0.0.3

func SendTasksToWorkers(msgs ...string) error

Function used by schedule.go to communicate the scheduled tasks to the workers. This takes an array of Task Name/Prefixes+MagicRune+Data strings and sends them to the proxy (which in turn send them to the workers.).

msg :: slice of string messages to send to workers (Task Name/Prefix+MagicRune+Data)

Returns an Error if communicating fails (server-shutoff or the full message could not be sent).

func StartCronScheduler

func StartCronScheduler() (func(), error)

ServerTask Startup Function for Cron Scheduling. Takes care of initialization.

func StartTaskQueue

func StartTaskQueue() (func(), error)

ServerTask Startup Function for Schedule Task System. Creates Workers and communication channels with ZeroMQ.

Types

type CronEvent

type CronEvent struct {
	Schedule string
	Event    func()
}

A Cron Event represents a function that should be run at a certain schedule. This structure should be used when scheduling events at the onset of the application

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL