Skip to content

Commit

Permalink
fix(emozi): login
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Oct 14, 2024
1 parent 6349f38 commit 23c0949
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions plugin/emozi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ func init() {
usr := emozi.Anonymous()
data, err := os.ReadFile(en.DataFolder() + "user.txt")
refresh := func() {
t := time.NewTicker(time.Hour)
defer t.Stop()
for range t.C {
if !usr.IsValid() {
time.Sleep(time.Second * 2)
err := usr.Login()
if err != nil {
logrus.Warnln("[emozi] 重新登录账号失败:", err)
go func() {
t := time.NewTicker(time.Hour)
defer t.Stop()
for range t.C {
if !usr.IsValid() {
time.Sleep(time.Second * 2)
err := usr.Login()
if err != nil {
logrus.Warnln("[emozi] 重新登录账号失败:", err)
}
}
}
}
}()
}
refresher := sync.Once{}
if err == nil {
Expand Down

0 comments on commit 23c0949

Please sign in to comment.