1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

db: remove remaining storage.loadX calls

This commit is contained in:
Harvey Tindall 2023-06-25 20:18:40 +01:00
parent ea0598e507
commit e1c215b72e
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
4 changed files with 0 additions and 13 deletions

View File

@ -15,7 +15,6 @@ import (
func (app *appContext) checkInvites() { func (app *appContext) checkInvites() {
currentTime := time.Now() currentTime := time.Now()
app.storage.loadInvites()
for _, data := range app.storage.GetInvites() { for _, data := range app.storage.GetInvites() {
expiry := data.ValidTill expiry := data.ValidTill
if !currentTime.After(expiry) { if !currentTime.After(expiry) {
@ -59,7 +58,6 @@ func (app *appContext) checkInvites() {
func (app *appContext) checkInvite(code string, used bool, username string) bool { func (app *appContext) checkInvite(code string, used bool, username string) bool {
currentTime := time.Now() currentTime := time.Now()
app.storage.loadInvites()
inv, match := app.storage.GetInvitesKey(code) inv, match := app.storage.GetInvitesKey(code)
if !match { if !match {
return false return false
@ -128,7 +126,6 @@ func (app *appContext) checkInvite(code string, used bool, username string) bool
func (app *appContext) GenerateInvite(gc *gin.Context) { func (app *appContext) GenerateInvite(gc *gin.Context) {
var req generateInviteDTO var req generateInviteDTO
app.debug.Println("Generating new invite") app.debug.Println("Generating new invite")
app.storage.loadInvites()
gc.BindJSON(&req) gc.BindJSON(&req)
currentTime := time.Now() currentTime := time.Now()
validTill := currentTime.AddDate(0, req.Months, req.Days) validTill := currentTime.AddDate(0, req.Months, req.Days)
@ -222,7 +219,6 @@ func (app *appContext) GenerateInvite(gc *gin.Context) {
func (app *appContext) GetInvites(gc *gin.Context) { func (app *appContext) GetInvites(gc *gin.Context) {
app.debug.Println("Invites requested") app.debug.Println("Invites requested")
currentTime := time.Now() currentTime := time.Now()
app.storage.loadInvites()
app.checkInvites() app.checkInvites()
var invites []inviteDTO var invites []inviteDTO
for _, inv := range app.storage.GetInvites() { for _, inv := range app.storage.GetInvites() {
@ -344,8 +340,6 @@ func (app *appContext) SetNotify(gc *gin.Context) {
changed := false changed := false
for code, settings := range req { for code, settings := range req {
app.debug.Printf("%s: Notification settings change requested", code) app.debug.Printf("%s: Notification settings change requested", code)
app.storage.loadInvites()
app.storage.loadEmails()
invite, ok := app.storage.GetInvitesKey(code) invite, ok := app.storage.GetInvitesKey(code)
if !ok { if !ok {
app.err.Printf("%s Notification setting change failed: Invalid code", code) app.err.Printf("%s Notification setting change failed: Invalid code", code)

View File

@ -42,11 +42,6 @@ func (app *appContext) MyDetails(gc *gin.Context) {
resp.Expiry = exp.Expiry.Unix() resp.Expiry = exp.Expiry.Unix()
} }
app.storage.loadEmails()
app.storage.loadDiscordUsers()
app.storage.loadMatrixUsers()
app.storage.loadTelegramUsers()
if emailEnabled { if emailEnabled {
resp.Email = &MyDetailsContactMethodsDTO{} resp.Email = &MyDetailsContactMethodsDTO{}
if email, ok := app.storage.GetEmailsKey(user.ID); ok && email.Addr != "" { if email, ok := app.storage.GetEmailsKey(user.ID); ok && email.Addr != "" {

View File

@ -116,7 +116,6 @@ func (rt *housekeepingDaemon) run() {
break break
} }
started := time.Now() started := time.Now()
rt.app.storage.loadInvites()
for _, job := range rt.jobs { for _, job := range rt.jobs {
job(rt.app) job(rt.app)

View File

@ -100,7 +100,6 @@ func pwrMonitor(app *appContext, watcher *fsnotify.Watcher) {
app.debug.Printf("Error: %s", err) app.debug.Printf("Error: %s", err)
return return
} }
app.storage.loadEmails()
uid := user.ID uid := user.ID
if uid == "" { if uid == "" {
app.err.Printf("Couldn't get user ID for user \"%s\"", pwr.Username) app.err.Printf("Couldn't get user ID for user \"%s\"", pwr.Username)