Add session keepAlive

This commit is contained in:
ekzyis 2023-08-15 21:57:17 +02:00
parent 7e892859c3
commit 88e2ff8b41
3 changed files with 14 additions and 1 deletions

2
go.mod
View File

@ -12,7 +12,7 @@ require (
require (
github.com/bwmarrin/discordgo v0.27.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/ekzyis/sn-goapi v0.1.1 // indirect
github.com/ekzyis/sn-goapi v0.2.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect

4
go.sum
View File

@ -9,6 +9,10 @@ github.com/ekzyis/sn-goapi v0.1.0 h1:B/v120DgYlpuzqkyiRTMb6C7JIoU3RaYE9M8D6m6OLQ
github.com/ekzyis/sn-goapi v0.1.0/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo=
github.com/ekzyis/sn-goapi v0.1.1 h1:FLCbaAIZ1qngtFZTfzkrp4HPFzHUPStdUgLHUPz82Jo=
github.com/ekzyis/sn-goapi v0.1.1/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo=
github.com/ekzyis/sn-goapi v0.1.2-0.20230815195350-cab35b4a3731 h1:BukOC3+ljt0LVIRnsmnWjeqwcCZpVkGzI4W0GdIm1RY=
github.com/ekzyis/sn-goapi v0.1.2-0.20230815195350-cab35b4a3731/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo=
github.com/ekzyis/sn-goapi v0.2.0 h1:k5YJlG+OguQEQRlbS5KghUttbfJaEkfvIfqB8B133FY=
github.com/ekzyis/sn-goapi v0.2.0/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=

View File

@ -43,8 +43,17 @@ func CheckNotifications() {
}
}
func SessionKeepAlive() {
for {
log.Println("Refresh session using GET /api/auth/session ...")
sn.RefreshSession()
WaitUntilNextHour()
}
}
func main() {
go CheckNotifications()
go SessionKeepAlive()
for {
stories, err := FetchHackerNewsTopStories()