Skip to content

Commit

Permalink
execute getToken when service enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
小滋润 committed Nov 11, 2024
1 parent f75f93f commit b76ff92
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion service/thirdparty/email/enter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package email

import (
"fmt"

"github.com/ZiRunHua/LeapLedger/global/cron"
)

Expand Down Expand Up @@ -43,7 +44,14 @@ func (e *thirdPartyResponseError) Error() string {

func init() {
_, err := cron.Scheduler.Every(30).Minute().Do(
cron.MakeJobFunc(Service.getToken),
cron.MakeJobFunc(
func() error {
if false == ServiceStatus {
return nil
}
return Service.getToken()
},
),
)
if err != nil {
panic(err)
Expand Down

0 comments on commit b76ff92

Please sign in to comment.