summaryrefslogtreecommitdiffstats
path: root/app/email_batching.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-10-03 10:53:53 -0500
committerGitHub <noreply@github.com>2017-10-03 10:53:53 -0500
commit5e69ce099f521aa49fc267c62235c003eae530ff (patch)
treec7177e4cac419082753225819f62d07c8b5671e8 /app/email_batching.go
parentbfe7955fb0c72bb6f3e0a1e0aaca70cff27d7ddc (diff)
downloadchat-5e69ce099f521aa49fc267c62235c003eae530ff.tar.gz
chat-5e69ce099f521aa49fc267c62235c003eae530ff.tar.bz2
chat-5e69ce099f521aa49fc267c62235c003eae530ff.zip
Goroutine wranglin (#7556)
* goroutine wranglin * synchronize WebConn.WritePump
Diffstat (limited to 'app/email_batching.go')
-rw-r--r--app/email_batching.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/email_batching.go b/app/email_batching.go
index b9f89d646..4c546531f 100644
--- a/app/email_batching.go
+++ b/app/email_batching.go
@@ -175,7 +175,11 @@ func (job *EmailBatchingJob) checkPendingNotifications(now time.Time, handler fu
// send the email notification if it's been long enough
if now.Sub(time.Unix(batchStartTime/1000, 0)) > time.Duration(interval)*time.Second {
- go handler(userId, notifications)
+ job.app.Go(func(userId string, notifications []*batchedNotification) func() {
+ return func() {
+ handler(userId, notifications)
+ }
+ }(userId, notifications))
delete(job.pendingNotifications, userId)
}
}