implement user expiry functionality
All works now, but i'll add a field on the accounts tab for users with an expiry, as well as a 'disabled' badge.
This commit is contained in:
@@ -4,7 +4,7 @@ import "time"
|
||||
|
||||
// https://bbengfort.github.io/snippets/2016/06/26/background-work-goroutines-timer.html THANKS
|
||||
|
||||
type repeater struct {
|
||||
type inviteDaemon struct {
|
||||
Stopped bool
|
||||
ShutdownChannel chan string
|
||||
Interval time.Duration
|
||||
@@ -12,8 +12,8 @@ type repeater struct {
|
||||
app *appContext
|
||||
}
|
||||
|
||||
func newRepeater(interval time.Duration, app *appContext) *repeater {
|
||||
return &repeater{
|
||||
func newInviteDaemon(interval time.Duration, app *appContext) *inviteDaemon {
|
||||
return &inviteDaemon{
|
||||
Stopped: false,
|
||||
ShutdownChannel: make(chan string),
|
||||
Interval: interval,
|
||||
@@ -22,7 +22,7 @@ func newRepeater(interval time.Duration, app *appContext) *repeater {
|
||||
}
|
||||
}
|
||||
|
||||
func (rt *repeater) run() {
|
||||
func (rt *inviteDaemon) run() {
|
||||
rt.app.info.Println("Invite daemon started")
|
||||
for {
|
||||
select {
|
||||
@@ -42,7 +42,7 @@ func (rt *repeater) run() {
|
||||
}
|
||||
}
|
||||
|
||||
func (rt *repeater) shutdown() {
|
||||
func (rt *inviteDaemon) shutdown() {
|
||||
rt.Stopped = true
|
||||
rt.ShutdownChannel <- "Down"
|
||||
<-rt.ShutdownChannel
|
||||
|
||||
Reference in New Issue
Block a user