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:
Harvey Tindall
2021-02-28 15:41:06 +00:00
parent 2934832a98
commit 1e9d184508
21 changed files with 500 additions and 132 deletions
+5 -5
View File
@@ -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