use app identifier instead of ctx

changing this because ctx is commonly used with the context package.
This commit is contained in:
Harvey Tindall
2020-08-16 13:36:54 +01:00
parent fffb3471d6
commit fd766e7b1a
9 changed files with 452 additions and 445 deletions
+7 -7
View File
@@ -9,21 +9,21 @@ type Repeater struct {
ShutdownChannel chan string
Interval time.Duration
period time.Duration
ctx *appContext
app *appContext
}
func NewRepeater(interval time.Duration, ctx *appContext) *Repeater {
func NewRepeater(interval time.Duration, app *appContext) *Repeater {
return &Repeater{
Stopped: false,
ShutdownChannel: make(chan string),
Interval: interval,
period: interval,
ctx: ctx,
app: app,
}
}
func (rt *Repeater) Run() {
rt.ctx.info.Println("Invite daemon started")
rt.app.info.Println("Invite daemon started")
for {
select {
case <-rt.ShutdownChannel:
@@ -33,9 +33,9 @@ func (rt *Repeater) Run() {
break
}
started := time.Now()
rt.ctx.storage.loadInvites()
rt.ctx.debug.Println("Daemon: Checking invites")
rt.ctx.checkInvites()
rt.app.storage.loadInvites()
rt.app.debug.Println("Daemon: Checking invites")
rt.app.checkInvites()
finished := time.Now()
duration := finished.Sub(started)
rt.period = rt.Interval - duration