cron

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtendLockExpiration

func ExtendLockExpiration(rc redis.Conn, key string, value string, expiration int) error

ExtendLockExpiration extends our lock expiration by the passed in number of seconds

func GrabLock

func GrabLock(rc redis.Conn, key string, value string, expiration int) (bool, error)

GrabLock grabs the passed in lock from redis in an atomic operation. It returns whether the lock was available and acquired

func ReleaseLock

func ReleaseLock(rc redis.Conn, key string, value string) error

ReleaseLock releases the passed in lock, returning any error encountered while doing so. It is not considered an error to release a lock that is no longer present

func StartMinuteCron

func StartMinuteCron(quit chan bool, rp *redis.Pool, name string, cronFunc Function)

StartMinuteCron calls the passed in function every minute, making sure it acquires a lock so that only one process is running at once

Types

type Function

type Function func(rc redis.Conn, lockName string, lockValue string) error

Function is the function that will be called on our schedule

Jump to

Keyboard shortcuts

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