Compare commits
2 Commits
6782362af1
...
eea0b1c0f6
Author | SHA1 | Date | |
---|---|---|---|
|
eea0b1c0f6 | ||
|
90b73edc34 |
6
main.go
6
main.go
@ -176,10 +176,10 @@ func main() { // {{{
|
||||
func scheduleHandler() { // {{{
|
||||
// Wait for the approximate minute.
|
||||
wait := 60000 - time.Now().Sub(time.Now().Truncate(time.Minute)).Milliseconds()
|
||||
logger.Info("schedule", "wait", wait/1000)
|
||||
time.Sleep(time.Millisecond * time.Duration(wait))
|
||||
tick := time.NewTicker(time.Minute)
|
||||
for {
|
||||
<-tick.C
|
||||
for _, event := range ExpiredSchedules() {
|
||||
notificationManager.Send(
|
||||
event.UserID,
|
||||
@ -193,6 +193,7 @@ func scheduleHandler() { // {{{
|
||||
),
|
||||
)
|
||||
}
|
||||
<-tick.C
|
||||
}
|
||||
} // }}}
|
||||
|
||||
@ -764,7 +765,7 @@ func keyCounter(w http.ResponseWriter, r *http.Request, sess *session.T) { // {{
|
||||
func notificationAcknowledge(w http.ResponseWriter, r *http.Request, sess *session.T) { // {{{
|
||||
logger.Info("webserver", "request", "/notification/ack")
|
||||
var err error
|
||||
|
||||
w.Header().Add("Access-Control-Allow-Origin", "*")
|
||||
|
||||
err = AcknowledgeNotification(r.URL.Query().Get("uuid"))
|
||||
if err != nil {
|
||||
@ -776,4 +777,5 @@ func notificationAcknowledge(w http.ResponseWriter, r *http.Request, sess *sessi
|
||||
"OK": true,
|
||||
})
|
||||
} // }}}
|
||||
|
||||
// vim: foldmethod=marker
|
||||
|
Loading…
Reference in New Issue
Block a user