serverlock

package
v6.1.0-beta1-empolis+i... Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServerLockService

type ServerLockService struct {
	SQLStore *sqlstore.SqlStore `inject:""`
	// contains filtered or unexported fields
}

ServerLockService allows servers in HA mode to claim a lock and execute an function if the server was granted the lock

func (*ServerLockService) Init

func (sl *ServerLockService) Init() error

Init this service

func (*ServerLockService) LockAndExecute

func (sl *ServerLockService) LockAndExecute(ctx context.Context, actionName string, maxInterval time.Duration, fn func()) error

LockAndExecute try to create a lock for this server and only executes the `fn` function when successful. This should not be used at low internal. But services that needs to be run once every ex 10m.

Jump to

Keyboard shortcuts

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