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